Top-level segmentation class. More...
#include <fgbgsegment.h>
Classes | |
class | Background |
Class modelling background hypothesis. More... | |
class | ColorModel |
Color model class. More... | |
class | FlatSurface |
Class modelling flat surface hypothesis. More... | |
class | Foreground |
Class modelling foreground hypothesis. More... | |
Public Member Functions | |
void | Execute (Image< uint8_t > &image, Image< float > &disp, bool initialize, int loops=1, int startx=-1, int starty=-1) |
Execution of Segmentation. | |
FgBgSegment (int width, int height, int drange, float gradWeight=20.0, float w_size=0.20f, float b_size=0.20f) | |
Constructor. | |
float | GetGradWeight () |
Get current gradient weight Flag. | |
void | GetSurfaceMinMax (float &min_x, float &min_y, float &max_x, float &max_y) |
void | GetSurfaceParameters (float &alpha, float &beta, float &disp) |
Get Surface Parameters from current estimation. | |
bool | GetUniform () |
Get uniform Flag. | |
bool | GetWithColorHoles () |
Get withColorHoles Flag. | |
bool | GetWithColors () |
Get withColors Flag. | |
bool | GetWithDisparities () |
Get withDisparities Flag. | |
bool | GetWithSurface () |
Get withSurface Flag. | |
void | MakeBorderImage (Image< uint8_t > &image) |
Dump Segmentation Image. | |
void | MakeMaskImage (Image< uint8_t > &image, int val=255, int obj=0) |
Dump Segmentation Mask Image. | |
void | MakeSegmentImage (Image< uint8_t > &image) |
Dump Segmentation Image. | |
void | SetGradWeight (float val) |
Set gradient weight Flag. | |
void | SetNewForeground (Image< uint8_t > &mask, Image< float > &dimg, int drange, bool reuseLast=false) |
Set new foreground hypothesis. | |
void | SetNewForeground (int startx, int starty, Image< float > &dimg, int drange_) |
Set new foreground hypothesis. | |
void | SetUniform (bool val) |
Set uniform Flag. | |
void | SetWithColorHoles (bool val) |
Set withColorHoles Flag. | |
void | SetWithColors (bool val) |
Set withColors Flag. | |
void | SetWithDisparities (bool val) |
Set withDisparities Flag. | |
void | SetWithSurface (bool val) |
Set withSurface Flag. | |
void | UseGPU (bool gpuopt=true) |
Whether or not to use the GPU based belief propagation. | |
~FgBgSegment () | |
Static Public Attributes | |
static const int | hist_size = 12 |
number of histogram bins | |
Protected Member Functions | |
void | CreateHistograms (bool allPoints) |
Create all histograms. | |
void | InitSegmentation () |
Initialise the segmentation. | |
void | RGBToHSV (Image< uint8_t > &cimg) |
Conversion of images from RGB to HSV. | |
Static Protected Member Functions | |
template<int numFigures> | |
static void | PixSegment (FgBgSegment &segm) |
CPU based segmentation object. | |
Protected Attributes | |
float | ballSize |
std::vector< ColorModel > | colorPriors |
Prior color models. | |
CudaSegment * | cudaSegment |
CUDA based segmentation object. | |
Image< float > * | disparities |
Current disparity data. | |
int | drange |
Disparity Range. | |
std::vector< Foreground * > | figures |
Foreground model. | |
bool | gpuopt |
Whether GPU optimization is used. | |
float | gradWeight |
Gradient Importance Weight. | |
Image< uint8_t > | grey |
Grey image data. | |
Background | ground |
Background model. | |
int | height |
Image height. | |
Image< uint8_t > | hue |
Hue image data. | |
Image< uint8_t > | saturation |
Saturation image data. | |
FlatSurface | surface |
Flat surface model. | |
bool | uniform |
int | verbose |
Amount of status output. | |
int | width |
Image width. | |
float | windowSize |
For controlling rough size of initialisation region around point. | |
bool | withColorHoles |
Whether data has incomplete color information. | |
bool | withColors |
Whether to use colour cue. | |
bool | withDisparities |
Whether to use disparity cue. | |
bool | withSurface |
Whether to use surface model. | |
Static Private Attributes | |
static const float | eps = 1e-6f |
Friends | |
class | CudaSegment |
Top-level segmentation class.
Definition at line 106 of file fgbgsegment.h.
FgBgSegment::FgBgSegment | ( | int | width, | |
int | height, | |||
int | drange, | |||
float | gradWeight = 20.0 , |
|||
float | w_size = 0.20f , |
|||
float | b_size = 0.20f | |||
) |
Constructor.
Segmentation
width | Width of the Image | |
height | Height of the Image | |
drange | Disparity range | |
gradWeight | Gradient Importance Weight |
Definition at line 50 of file fgbgsegment.cpp.
FgBgSegment::~FgBgSegment | ( | ) |
Definition at line 76 of file fgbgsegment.cpp.
void FgBgSegment::CreateHistograms | ( | bool | allPoints | ) | [protected] |
Create all histograms.
Create all histograms for foreground, background and flat surface hypotheses
allPoints | Whether to use all points to create histograms or only those in the disparity range |
Definition at line 1110 of file fgbgsegment.cpp.
void FgBgSegment::Execute | ( | Image< uint8_t > & | image, | |
Image< float > & | disp, | |||
bool | initialize, | |||
int | loops = 1 , |
|||
int | startx = -1 , |
|||
int | starty = -1 | |||
) |
Execution of Segmentation.
Execution of Segmentation on one image for a number of iterations
image | Image to segment | |
disp | Disparity Image | |
initialize | Whether or not to reinitialise the models | |
loops | How many iterations per image | |
startx | not used | |
starty | not used |
Definition at line 1603 of file fgbgsegment.cpp.
float FgBgSegment::GetGradWeight | ( | ) |
Get current gradient weight Flag.
Definition at line 1503 of file fgbgsegment.cpp.
void FgBgSegment::GetSurfaceMinMax | ( | float & | min_x, | |
float & | min_y, | |||
float & | max_x, | |||
float & | max_y | |||
) |
Definition at line 1451 of file fgbgsegment.cpp.
void FgBgSegment::GetSurfaceParameters | ( | float & | alpha, | |
float & | beta, | |||
float & | disp | |||
) |
Get Surface Parameters from current estimation.
Definition at line 1440 of file fgbgsegment.cpp.
bool FgBgSegment::GetUniform | ( | ) |
Get uniform Flag.
Definition at line 1482 of file fgbgsegment.cpp.
bool FgBgSegment::GetWithColorHoles | ( | ) |
Get withColorHoles Flag.
Definition at line 1475 of file fgbgsegment.cpp.
bool FgBgSegment::GetWithColors | ( | ) |
Get withColors Flag.
Definition at line 1468 of file fgbgsegment.cpp.
bool FgBgSegment::GetWithDisparities | ( | ) |
Get withDisparities Flag.
Definition at line 1496 of file fgbgsegment.cpp.
bool FgBgSegment::GetWithSurface | ( | ) |
Get withSurface Flag.
Definition at line 1489 of file fgbgsegment.cpp.
void FgBgSegment::InitSegmentation | ( | ) | [protected] |
Initialise the segmentation.
Definition at line 594 of file fgbgsegment.cpp.
void FgBgSegment::MakeBorderImage | ( | Image< uint8_t > & | image | ) |
Dump Segmentation Image.
Dump Bordered Segmentation Image to a file segm*.ppm
image | RGB image to be overlayed with segmentation border |
Definition at line 1551 of file fgbgsegment.cpp.
void FgBgSegment::MakeMaskImage | ( | Image< uint8_t > & | image, | |
int | val = 255 , |
|||
int | obj = 0 | |||
) |
Dump Segmentation Mask Image.
Dump Segmentation Mask Image to a file mask*.pgm
image | Binary image to be Dumped | |
val | Intensity value of the segmentation mask | |
obj | ID of foreground hypothesis |
Definition at line 1532 of file fgbgsegment.cpp.
void FgBgSegment::MakeSegmentImage | ( | Image< uint8_t > & | image | ) |
Dump Segmentation Image.
Dump Segmentation Image to a file segm*.pgm
image | Gray-level image to be Dumped |
Definition at line 1505 of file fgbgsegment.cpp.
void FgBgSegment::PixSegment | ( | FgBgSegment & | segm | ) | [inline, static, protected] |
CPU based segmentation object.
Templated CPU based segmentation object given the number of foreground objects to segment
segm | Segmentation object |
Definition at line 1230 of file fgbgsegment.cpp.
void FgBgSegment::RGBToHSV | ( | Image< uint8_t > & | cimg | ) | [protected] |
Conversion of images from RGB to HSV.
Conversion of images from RGB to HSV
cimg | RGB image to convert to HSV |
Definition at line 1408 of file fgbgsegment.cpp.
void FgBgSegment::SetGradWeight | ( | float | val | ) |
Set gradient weight Flag.
Definition at line 1498 of file fgbgsegment.cpp.
void FgBgSegment::SetNewForeground | ( | Image< uint8_t > & | mask, | |
Image< float > & | dimg, | |||
int | drange, | |||
bool | reuseLast = false | |||
) |
Set new foreground hypothesis.
Reinitialize the foreground disparity model based on mask
mask | Binary mask | |
dimg | Disparity image on which initialisation is based | |
drange_ | Disparity range | |
reuseLast | Whether or not to re-use already existing foreground hypothesis |
Definition at line 1156 of file fgbgsegment.cpp.
void FgBgSegment::SetNewForeground | ( | int | startx, | |
int | starty, | |||
Image< float > & | dimg, | |||
int | drange_ | |||
) |
Set new foreground hypothesis.
Reinitialize the foreground disparity model based on pixel position
startx | X-coordinate of ellipse used for initialization | |
starty | Y-coordinate of ellipse used for initialization | |
dimg | Disparity image on which initialisation is based | |
drange_ | Disparity range |
Definition at line 1118 of file fgbgsegment.cpp.
void FgBgSegment::SetUniform | ( | bool | val | ) |
Set uniform Flag.
Definition at line 1477 of file fgbgsegment.cpp.
void FgBgSegment::SetWithColorHoles | ( | bool | val | ) |
Set withColorHoles Flag.
Definition at line 1470 of file fgbgsegment.cpp.
void FgBgSegment::SetWithColors | ( | bool | val | ) |
Set withColors Flag.
Definition at line 1463 of file fgbgsegment.cpp.
void FgBgSegment::SetWithDisparities | ( | bool | val | ) |
Set withDisparities Flag.
Definition at line 1491 of file fgbgsegment.cpp.
void FgBgSegment::SetWithSurface | ( | bool | val | ) |
Set withSurface Flag.
Definition at line 1484 of file fgbgsegment.cpp.
void FgBgSegment::UseGPU | ( | bool | gpuopt = true |
) |
Whether or not to use the GPU based belief propagation.
Definition at line 85 of file fgbgsegment.cpp.
friend class CudaSegment [friend] |
Definition at line 108 of file fgbgsegment.h.
float FgBgSegment::ballSize [protected] |
Definition at line 296 of file fgbgsegment.h.
std::vector<ColorModel> FgBgSegment::colorPriors [protected] |
Prior color models.
Definition at line 283 of file fgbgsegment.h.
CudaSegment* FgBgSegment::cudaSegment [protected] |
CUDA based segmentation object.
Definition at line 299 of file fgbgsegment.h.
Image<float>* FgBgSegment::disparities [protected] |
Current disparity data.
Definition at line 281 of file fgbgsegment.h.
int FgBgSegment::drange [protected] |
Disparity Range.
Definition at line 290 of file fgbgsegment.h.
const float FgBgSegment::eps = 1e-6f [static, private] |
Definition at line 111 of file fgbgsegment.h.
std::vector<Foreground*> FgBgSegment::figures [protected] |
Foreground model.
Definition at line 272 of file fgbgsegment.h.
bool FgBgSegment::gpuopt [protected] |
Whether GPU optimization is used.
Definition at line 301 of file fgbgsegment.h.
float FgBgSegment::gradWeight [protected] |
Gradient Importance Weight.
Definition at line 292 of file fgbgsegment.h.
Image<uint8_t> FgBgSegment::grey [protected] |
Grey image data.
Definition at line 279 of file fgbgsegment.h.
Background FgBgSegment::ground [protected] |
Background model.
Definition at line 268 of file fgbgsegment.h.
int FgBgSegment::height [protected] |
Image height.
Definition at line 288 of file fgbgsegment.h.
const int FgBgSegment::hist_size = 12 [static] |
number of histogram bins
Definition at line 114 of file fgbgsegment.h.
Image<uint8_t> FgBgSegment::hue [protected] |
Hue image data.
Definition at line 275 of file fgbgsegment.h.
Image<uint8_t> FgBgSegment::saturation [protected] |
Saturation image data.
Definition at line 277 of file fgbgsegment.h.
FlatSurface FgBgSegment::surface [protected] |
Flat surface model.
Definition at line 270 of file fgbgsegment.h.
bool FgBgSegment::uniform [protected] |
Definition at line 263 of file fgbgsegment.h.
int FgBgSegment::verbose [protected] |
Amount of status output.
Definition at line 265 of file fgbgsegment.h.
int FgBgSegment::width [protected] |
Image width.
Definition at line 286 of file fgbgsegment.h.
float FgBgSegment::windowSize [protected] |
For controlling rough size of initialisation region around point.
Definition at line 295 of file fgbgsegment.h.
bool FgBgSegment::withColorHoles [protected] |
Whether data has incomplete color information.
Definition at line 259 of file fgbgsegment.h.
bool FgBgSegment::withColors [protected] |
Whether to use colour cue.
Definition at line 255 of file fgbgsegment.h.
bool FgBgSegment::withDisparities [protected] |
Whether to use disparity cue.
Definition at line 257 of file fgbgsegment.h.
bool FgBgSegment::withSurface [protected] |
Whether to use surface model.
Definition at line 253 of file fgbgsegment.h.