darknet/src/image.h

80 lines
2.6 KiB
C
Raw Normal View History

2013-11-05 03:11:01 +08:00
#ifndef IMAGE_H
#define IMAGE_H
2015-06-10 15:11:41 +08:00
#include <stdlib.h>
#include <stdio.h>
#include <float.h>
#include <string.h>
#include <math.h>
2015-08-25 09:27:42 +08:00
#include "box.h"
2015-06-10 15:11:41 +08:00
2013-11-05 03:11:01 +08:00
typedef struct {
int h;
int w;
int c;
float *data;
2013-11-05 03:11:01 +08:00
} image;
2015-02-24 10:52:05 +08:00
float get_color(int c, int x, int max);
void flip_image(image a);
void draw_box(image a, int x1, int y1, int x2, int y2, float r, float g, float b);
2015-06-17 05:54:26 +08:00
void draw_box_width(image a, int x1, int y1, int x2, int y2, int w, float r, float g, float b);
2015-08-25 09:27:42 +08:00
void draw_bbox(image a, box bbox, int w, float r, float g, float b);
2015-11-27 03:48:01 +08:00
void draw_label(image a, int r, int c, image label, const float *rgb);
void draw_detections(image im, int num, float thresh, box *boxes, float **probs, char **names, image *labels, int classes);
2014-02-25 04:21:31 +08:00
image image_distance(image a, image b);
void scale_image(image m, float s);
2015-04-10 06:18:54 +08:00
image crop_image(image im, int dx, int dy, int w, int h);
image resize_image(image im, int w, int h);
2015-07-22 02:38:36 +08:00
image resize_image2(image im, int w, int h);
2014-04-17 08:05:29 +08:00
void translate_image(image m, float s);
2013-11-05 03:11:01 +08:00
void normalize_image(image p);
2015-04-10 14:00:33 +08:00
image rotate_image(image m, float rad);
2015-04-10 06:18:54 +08:00
void embed_image(image source, image dest, int dx, int dy);
2015-04-15 15:32:32 +08:00
void saturate_image(image im, float sat);
void exposure_image(image im, float sat);
void saturate_exposure_image(image im, float sat, float exposure);
void hsv_to_rgb(image im);
2015-06-10 15:11:41 +08:00
void rgbgr_image(image im);
2015-07-08 15:36:43 +08:00
void constrain_image(image im);
2015-09-23 08:34:48 +08:00
2015-07-08 15:36:43 +08:00
image grayscale_image(image im);
2015-09-23 08:34:48 +08:00
image threshold_image(image im, float thresh);
2015-04-10 06:18:54 +08:00
2013-12-03 08:41:40 +08:00
image collapse_image_layers(image source, int border);
2014-04-17 08:05:29 +08:00
image collapse_images_horz(image *ims, int n);
image collapse_images_vert(image *ims, int n);
2013-11-05 03:11:01 +08:00
2015-11-18 03:00:04 +08:00
void show_image(image p, const char *name);
void save_image(image p, const char *name);
void show_images(image *ims, int n, char *window);
2013-11-05 03:11:01 +08:00
void show_image_layers(image p, char *name);
2013-12-03 08:41:40 +08:00
void show_image_collapsed(image p, char *name);
2015-04-10 06:18:54 +08:00
2015-09-02 02:21:01 +08:00
#ifdef OPENCV
void save_image_jpg(image p, char *name);
#endif
2013-12-03 08:41:40 +08:00
void print_image(image m);
2013-11-05 03:11:01 +08:00
2015-04-10 06:18:54 +08:00
image make_image(int w, int h, int c);
2016-01-19 07:40:14 +08:00
image make_random_image(int w, int h, int c);
2015-04-10 06:18:54 +08:00
image make_empty_image(int w, int h, int c);
image float_to_image(int w, int h, int c, float *data);
2013-11-05 03:11:01 +08:00
image copy_image(image p);
2015-06-10 15:11:41 +08:00
image load_image(char *filename, int w, int h, int c);
2015-04-10 06:18:54 +08:00
image load_image_color(char *filename, int w, int h);
float get_pixel(image m, int x, int y, int c);
float get_pixel_extend(image m, int x, int y, int c);
void set_pixel(image m, int x, int y, int c, float val);
2015-07-22 02:38:36 +08:00
void add_pixel(image m, int x, int y, int c, float val);
2015-07-22 02:46:24 +08:00
float bilinear_interpolate(image im, float x, float y, int c);
2013-11-05 03:11:01 +08:00
image get_image_layer(image m, int l);
void free_image(image m);
2015-03-29 07:11:37 +08:00
void test_resize(char *filename);
2013-11-05 03:11:01 +08:00
#endif