-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhist-equ.h
More file actions
executable file
·99 lines (80 loc) · 3.15 KB
/
Copy pathhist-equ.h
File metadata and controls
executable file
·99 lines (80 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef HIST_EQU_COLOR_H
#define HIST_EQU_COLOR_H
#include <cuda_runtime.h>
#include <helper_cuda.h>
#include <helper_functions.h>
#include <helper_timer.h>
#define NUM_THREAD 256
//Must be even
typedef struct{
int w;
int h;
unsigned char * img;
} PGM_IMG;
typedef struct{
int w;
int h;
unsigned char * img_r;
unsigned char * img_g;
unsigned char * img_b;
} PPM_IMG;
typedef struct{
int w;
int h;
unsigned char * img_y;
unsigned char * img_u;
unsigned char * img_v;
} YUV_IMG;
typedef struct
{
int width;
int height;
float * h;
float * s;
unsigned char * l;
} HSL_IMG;
PPM_IMG read_ppm(const char * path);
void write_ppm(PPM_IMG img, const char * path);
void free_ppm(PPM_IMG img);
PGM_IMG read_pgm(const char * path);
void write_pgm(PGM_IMG img, const char * path);
void free_pgm(PGM_IMG img);
HSL_IMG rgb2hsl(PPM_IMG img_in);
PPM_IMG hsl2rgb(HSL_IMG img_in);
YUV_IMG rgb2yuv(PPM_IMG img_in);
PPM_IMG yuv2rgb(YUV_IMG img_in);
HSL_IMG rgb2hsl_gpu(PPM_IMG img_in);
PPM_IMG hsl2rgb_gpu(HSL_IMG img_in);
YUV_IMG rgb2yuv_gpu(PPM_IMG img_in);
PPM_IMG yuv2rgb_gpu(YUV_IMG img_in);
__global__ void rgb2hsl_gpu_son( unsigned char * d_r, unsigned char * d_g, unsigned char * d_b,
float * d_h , float * d_s , unsigned char * d_l ,
int size);
__global__ void hsl2rgb_gpu_son(float * d_h , float * d_s ,unsigned char * d_l ,
unsigned char * d_r, unsigned char * d_g, unsigned char * d_b,
int size);
__global__ void rgb2yuv_gpu_son(unsigned char * d_r, unsigned char * d_g, unsigned char * d_b,
unsigned char * d_y , unsigned char * d_u ,unsigned char * d_v ,
int size);
__global__ void yuv2rgb_gpu_son(unsigned char * d_y , unsigned char * d_u ,unsigned char * d_v ,
unsigned char * d_r, unsigned char * d_g, unsigned char * d_b,
int size);
void histogram(int * hist_out, unsigned char * img_in, int img_size, int nbr_bin);
void histogram_equalization(unsigned char * img_out, unsigned char * img_in,
int * hist_in, int img_size, int nbr_bin);
void histogram_gpu(int * hist_out, unsigned char * img_in, int img_size, int nbr_bin);
__global__ void histogram_gpu_son(unsigned char * d_img, unsigned int * d_hist, int img_size, int serialNum);
void histogram_equalization_gpu(unsigned char * img_out, unsigned char * img_in, int * hist_in, int img_size, int nbr_bin);
__global__ void histogram_equalization_gpu_son (unsigned char * d_in, unsigned char * d_out, int * d_lut, int img_size, int serialNum);
__global__ void clean(unsigned int * e, int n);
//Contrast enhancement for gray-scale images
//Contrast enhancement for color images
PGM_IMG contrast_enhancement_g(PGM_IMG img_in);
PPM_IMG contrast_enhancement_c_rgb(PPM_IMG img_in);
PPM_IMG contrast_enhancement_c_yuv(PPM_IMG img_in);
PPM_IMG contrast_enhancement_c_hsl(PPM_IMG img_in);
PGM_IMG contrast_enhancement_g_gpu(PGM_IMG img_in);
PPM_IMG contrast_enhancement_c_rgb_gpu(PPM_IMG img_in);
PPM_IMG contrast_enhancement_c_yuv_gpu(PPM_IMG img_in);
PPM_IMG contrast_enhancement_c_hsl_gpu(PPM_IMG img_in);
#endif