Meanshift  1.0
image.h
1 /*
2  * Copyright (c) 2018, Damir Demirović <damir.demirovic@untz.ba>
3  * All rights reserved.
4  *
5  * This program is free software: you can use, modify and/or
6  * redistribute it under the terms of the GNU General Public
7  * License as published by the Free Software Foundation, either
8  * version 3 of the License, or (at your option) any later
9  * version. You should have received a copy of this license along
10  * this program. If not, see <http://www.gnu.org/licenses/>.
11  */
12 
13 #ifndef IMAGE_H
14 #define IMAGE_H
15 
16 
17 #include <cmath>
18 #include <vector>
19 #include <iostream>
20 
21 using namespace std;
22 
23 typedef unsigned char uchar;
24 
25 uchar *AllocateUcharImage(int width, int height, int nchannel);
26 uchar GetPixel(uchar *im, int width, int height, int x, int y, int channel);
27 void SetPixel(uchar *im, int width, int height, int x, int y, const uchar val, int channel);
28 int** GenerateLabels(int width, int height);
29 void LabelImage(uchar *res, int width, int height, int** labels, int regCount);
30 int range_distance(uchar* image, int width, int height, int x1, int y1, int x2, int y2 );
31 uchar *ConvertRGB2LUV(uchar * input, int width, int height, int nchannel);
32 uchar *ConvertLUV2RGB(uchar * origin, int width, int height, int nchannel);
33 float color_distance( const float* a, const float* b);
34 std::vector<int> GenerateRandomNumbers(int num);
35 
36 
37 #endif /* IMAGE_H */
38 
uchar * ConvertRGB2LUV(uchar *rgb, int width, int height, int nchannel)
Function ConvertRGB2LUV convert RGB image to LUV.
Definition: image.cpp:241
void LabelImage(uchar *image, int width, int height, int **labels, int regCount)
Function LabelImage in RGB colors.
Definition: image.cpp:76
float color_distance(const float *a, const float *b)
Function color_distance calculate color distance between the two pixels.
Definition: image.cpp:343
uchar * AllocateUcharImage(int width, int height, int nchannel)
Allocate space for the uchar image,.
Definition: image.cpp:29
uchar * ConvertLUV2RGB(uchar *luv, int width, int height, int nchannel)
Function ConvertLUV2RGB converts input image image from LUV to RGB color space.
Definition: image.cpp:271
void SetPixel(uchar *im, int width, int height, int x, int y, const uchar val, int nchannel)
Set Pixel at channel component of image at postition given with x and y.
Definition: image.cpp:300
int ** GenerateLabels(int width, int height)
Generate labels for clustering.
Definition: image.cpp:42
vector< int > GenerateRandomNumbers(int count)
Function generate random numbers.
Definition: image.cpp:58
int range_distance(uchar *image, int width, int height, int x1, int y1, int x2, int y2)
Function range_distance calculate range distance between two pixels.
Definition: image.cpp:329
uchar GetPixel(uchar *im, int width, int height, int x, int y, int nchannel)
Get Pixel at channel component of image at postition given with x and y.
Definition: image.cpp:314