2013-11-05 03:11:01 +08:00
|
|
|
#ifndef IMAGE_H
|
|
|
|
#define IMAGE_H
|
|
|
|
|
|
|
|
#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;
|
|
|
|
|
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);
|
|
|
|
void add_scalar_image(image m, float s);
|
2013-11-05 03:11:01 +08:00
|
|
|
void normalize_image(image p);
|
2013-12-03 08:41:40 +08:00
|
|
|
void z_normalize_image(image p);
|
2014-01-29 08:28:42 +08:00
|
|
|
void threshold_image(image p, float t);
|
2013-11-05 03:11:01 +08:00
|
|
|
void zero_image(image m);
|
|
|
|
void rotate_image(image m);
|
2013-11-07 08:09:41 +08:00
|
|
|
void subtract_image(image a, image b);
|
2014-01-29 08:28:42 +08:00
|
|
|
float avg_image_layer(image m, int l);
|
2013-12-03 08:41:40 +08:00
|
|
|
void embed_image(image source, image dest, int h, int w);
|
|
|
|
image collapse_image_layers(image source, int border);
|
2013-11-05 03:11:01 +08:00
|
|
|
|
|
|
|
void show_image(image p, char *name);
|
|
|
|
void show_image_layers(image p, char *name);
|
2013-12-03 08:41:40 +08:00
|
|
|
void show_image_collapsed(image p, char *name);
|
|
|
|
void print_image(image m);
|
2013-11-05 03:11:01 +08:00
|
|
|
|
|
|
|
image make_image(int h, int w, int c);
|
2013-11-14 02:50:38 +08:00
|
|
|
image make_empty_image(int h, int w, int c);
|
2013-11-05 03:11:01 +08:00
|
|
|
image make_random_image(int h, int w, int c);
|
2014-01-29 08:28:42 +08:00
|
|
|
image make_random_kernel(int size, int c, float scale);
|
|
|
|
image float_to_image(int h, int w, int c, float *data);
|
2013-11-05 03:11:01 +08:00
|
|
|
image copy_image(image p);
|
2014-02-15 02:26:31 +08:00
|
|
|
image load_image(char *filename, int h, int w);
|
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);
|
|
|
|
|
2013-12-03 08:41:40 +08:00
|
|
|
void two_d_convolve(image m, int mc, image kernel, int kc, int stride, image out, int oc, int edge);
|
2013-11-05 03:11:01 +08:00
|
|
|
void upsample_image(image m, int stride, image out);
|
2013-12-03 08:41:40 +08:00
|
|
|
void convolve(image m, image kernel, int stride, int channel, image out, int edge);
|
|
|
|
void back_convolve(image m, image kernel, int stride, int channel, image out, int edge);
|
|
|
|
void kernel_update(image m, image update, int stride, int channel, image out, int edge);
|
2013-11-05 03:11:01 +08:00
|
|
|
|
|
|
|
void free_image(image m);
|
|
|
|
#endif
|
|
|
|
|