Meanshift  1.0
Functions
image.cpp File Reference

Image helper functions. More...

#include "image.h"
Include dependency graph for image.cpp:

Functions

uchar * AllocateUcharImage (int width, int height, int nchannel)
 Allocate space for the uchar image,. More...
 
int ** GenerateLabels (int width, int height)
 Generate labels for clustering. More...
 
vector< int > GenerateRandomNumbers (int count)
 Function generate random numbers. More...
 
void LabelImage (uchar *image, int width, int height, int **labels, int regCount)
 Function LabelImage in RGB colors. More...
 
void RGB2LUV (float r, float g, float b, uchar *l, uchar *u, uchar *v)
 Function RGB2LUV converts RGB pixel value to LUV pixel value. More...
 
void LUV2RGB (float L, float u, float v, uchar *R, uchar *G, uchar *B)
 Function LUV2RGB converts LUV pixel value to RGB pixel value. More...
 
uchar * ConvertRGB2LUV (uchar *rgb, int width, int height, int nchannel)
 Function ConvertRGB2LUV convert RGB image to LUV. More...
 
uchar * ConvertLUV2RGB (uchar *luv, int width, int height, int nchannel)
 Function ConvertLUV2RGB converts input image image from LUV to RGB color space. More...
 
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. More...
 
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. More...
 
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. More...
 
float color_distance (const float *a, const float *b)
 Function color_distance calculate color distance between the two pixels. More...
 

Detailed Description

Image helper functions.

Author
Damir Demirović damir.nosp@m..dem.nosp@m.irovi.nosp@m.c@un.nosp@m.tz.ba

Function Documentation

◆ AllocateUcharImage()

uchar* AllocateUcharImage ( int  width,
int  height,
int  nchannel 
)

Allocate space for the uchar image,.

Parameters
width,heightand nchannel
Returns
img - allocated image

◆ color_distance()

float color_distance ( const float *  a,
const float *  b 
)

Function color_distance calculate color distance between the two pixels.

Parameters
a,binput images
Returns
the color distance

◆ ConvertLUV2RGB()

uchar* ConvertLUV2RGB ( uchar *  luv,
int  width,
int  height,
int  nchannel 
)

Function ConvertLUV2RGB converts input image image from LUV to RGB color space.

Parameters
luvLUV image to convert
widthwidth of the image
heightgheight of the image
nchannelnumber of image channels
Returns
The input character

◆ ConvertRGB2LUV()

uchar* ConvertRGB2LUV ( uchar *  rgb,
int  width,
int  height,
int  nchannel 
)

Function ConvertRGB2LUV convert RGB image to LUV.

Parameters
rgbRGB image to convert
widthwidth of the image
heightgheight of the image
nchannelnumber of image channels
Returns
luv the converted image

◆ GenerateLabels()

int** GenerateLabels ( int  width,
int  height 
)

Generate labels for clustering.

Function generate labels.

Parameters
width,height
Returns
labels

◆ GenerateRandomNumbers()

vector<int> GenerateRandomNumbers ( int  count)

Function generate random numbers.

Parameters
count- Count of numbers to be generated
Returns
number as vector<int>

◆ GetPixel()

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.

Parameters
imimage to convert
widthwidth of the image
heightgheight of the image
xx position in the image 0 < x < width
yy position in the image 0 < y < height
nchannelnumber of image channels
Returns
pixel value

◆ LabelImage()

void LabelImage ( uchar *  image,
int  width,
int  height,
int **  labels,
int  regCount 
)

Function LabelImage in RGB colors.

Parameters
imageimage to be labeled
widthwidth of the image
heightheighto of the image
labelscolor labels
regCountregions to be labeled

◆ LUV2RGB()

void LUV2RGB ( float  L,
float  u,
float  v,
uchar *  R,
uchar *  G,
uchar *  B 
)
inline

Function LUV2RGB converts LUV pixel value to RGB pixel value.

Parameters
Lcomponent of input image
ucomponent of input image
vcomponent of input image
rcomponent of output image
gcomponent of output image
bcomponent of output image

◆ range_distance()

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.

Parameters
imageimage to calculate
widthwidth of the image
heightheight of the image
x1first x position in the image
y1first y position in the image
x2second x position in the image
y2second y position in the image
Returns
squared sum of distances

◆ RGB2LUV()

void RGB2LUV ( float  r,
float  g,
float  b,
uchar *  l,
uchar *  u,
uchar *  v 
)
inline

Function RGB2LUV converts RGB pixel value to LUV pixel value.

Parameters
rcomponent of input image
gcomponent of input image
bcomponent of input image
lcomponent of output image
ucomponent of output image
vcomponent of output image 0<=l<=100, −134<=u<=220, −140<=v<=122

◆ SetPixel()

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.

Parameters
imimage to convert
widthwidth of the image
heightgheight of the image
xx position in the image
yy position in the image
valvalue to set at pixel location
nchannelnumber of image channels