darknet/src/image.h

95 lines
3.6 KiB
C
Raw Normal View History

2013-11-05 03:11:01 +08:00
#ifndef IMAGE_H
#define IMAGE_H
2019-01-07 04:51:38 +08:00
#include "darknet.h"
2013-11-05 03:11:01 +08:00
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
2019-01-07 04:51:38 +08:00
/*
2013-11-05 03:11:01 +08:00
typedef struct {
2019-01-07 04:51:38 +08:00
int w;
int h;
2013-11-05 03:11:01 +08:00
int c;
float *data;
2013-11-05 03:11:01 +08:00
} image;
2019-01-07 04:51:38 +08:00
*/
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 write_label(image a, int r, int c, image *characters, char *string, float *rgb);
2016-11-06 05:09:21 +08:00
void draw_detections(image im, int num, float thresh, box *boxes, float **probs, char **names, image **labels, int classes);
void draw_detections_v3(image im, detection *dets, int num, float thresh, char **names, image **alphabet, int classes, int ext_output);
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);
2016-08-06 06:27:07 +08:00
image random_crop_image(image im, int w, int h);
2016-09-08 13:27:56 +08:00
image random_augment_image(image im, float angle, float aspect, int low, int high, int size);
2016-09-02 07:48:41 +08:00
void random_distort_image(image im, float hue, float saturation, float exposure);
2019-01-14 18:56:42 +08:00
//LIB_API image resize_image(image im, int w, int h);
LIB_API void copy_image_from_bytes(image im, char *pdata);
void fill_image(image m, float s);
void letterbox_image_into(image im, int w, int h, image boxed);
2019-01-14 18:56:42 +08:00
//LIB_API image letterbox_image(image im, int w, int h);
2016-03-01 05:54:12 +08:00
image resize_min(image im, int min);
2016-11-19 13:51:36 +08:00
image resize_max(image im, int max);
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);
2016-03-14 14:18:42 +08:00
void rotate_image_cw(image im, int times);
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);
2016-09-02 07:48:41 +08:00
void distort_image(image im, float hue, float sat, float val);
2015-04-15 15:32:32 +08:00
void saturate_exposure_image(image im, float sat, float exposure);
void hsv_to_rgb(image im);
2019-01-14 18:56:42 +08:00
//LIB_API void rgbgr_image(image im);
2015-07-08 15:36:43 +08:00
void constrain_image(image im);
2016-08-06 06:27:07 +08:00
void composite_3d(char *f1, char *f2, char *out, int delta);
int best_3d_shift_r(image a, image b, int min, int max);
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);
2016-03-14 14:18:42 +08:00
void show_image_normalized(image im, const char *name);
2016-11-19 13:51:36 +08:00
void save_image_png(image im, const char *name);
2015-11-18 03:00:04 +08:00
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
2013-12-03 08:41:40 +08:00
void print_image(image m);
2013-11-05 03:11:01 +08:00
2019-01-14 18:56:42 +08:00
//LIB_API 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);
2019-01-14 18:56:42 +08:00
//LIB_API image load_image_color(char *filename, int w, int h);
2016-11-06 05:09:21 +08:00
image **load_alphabet();
2015-04-10 06:18:54 +08:00
//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);
//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);
2019-01-14 18:56:42 +08:00
//LIB_API 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