2013-11-05 03:11:01 +08:00
|
|
|
#ifndef IMAGE_H
|
|
|
|
#define IMAGE_H
|
|
|
|
|
2014-04-17 08:05:29 +08:00
|
|
|
|
2013-11-05 03:11:01 +08:00
|
|
|
#include "opencv2/highgui/highgui_c.h"
|
|
|
|
#include "opencv2/imgproc/imgproc_c.h"
|
|
|
|
typedef struct {
|
|
|
|
int h;
|
|
|
|
int w;
|
|
|
|
int c;
|
2014-01-29 08:28:42 +08:00
|
|
|
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);
|
2014-02-25 04:21:31 +08:00
|
|
|
image image_distance(image a, image b);
|
2014-01-29 08:28:42 +08:00
|
|
|
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);
|
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);
|
|
|
|
void rotate_image(image m);
|
2015-04-10 06:18:54 +08:00
|
|
|
void embed_image(image source, image dest, int dx, int dy);
|
|
|
|
|
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
|
|
|
|
|
|
|
void show_image(image p, char *name);
|
2014-04-11 16:00:27 +08:00
|
|
|
void save_image(image p, 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
|
|
|
|
2015-04-10 06:18:54 +08:00
|
|
|
image make_image(int w, int h, int c);
|
|
|
|
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-04-10 06:18:54 +08:00
|
|
|
image load_image(char *filename, int w, int h);
|
|
|
|
image load_image_color(char *filename, int w, int h);
|
|
|
|
|
2014-02-15 08:09:07 +08:00
|
|
|
image ipl_to_image(IplImage* src);
|
2013-11-05 03:11:01 +08:00
|
|
|
|
2014-01-29 08:28:42 +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);
|
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
|
|
|
|
|