Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Robert_G_2
Beginner
71 Views

ippiLabelMarker Issues

Hi All,

I am trying to do some image segmentation, and I am still having some trouble with ippiLabelMarker's implementation even after reading through the documentation and this post: https://software.intel.com/en-us/forums/topic/297054

Here is a snippet of my code:

//get size and allocate memory for buffer
	int LabelBufferSize;
	ippiLabelMarkersGetBufferSize_8u_C1R(sizeImg, &LabelBufferSize);
	Ipp8u* LabelBuffer = ippsMalloc_8u(LabelBufferSize);

//Compute Labels
	int minLabel = 0;
	int maxLabel = 255;
	int numLabels;
	ippiLabelMarkers_16u_C1IR(BinUnsigned, src16Step, sizeImg, minLabel, maxLabel, ippiNormL1, &numLabels, LabelBuffer);
	std::cout << numLabels << std::endl;

My first argument of the LabelMarkers function is "BinUnsigned", an Ippi16u* binarized image with pixel values of 0 and 254. 

Based on the forum post linked above and all the documentation I've read, my understanding is that the LabelMarker image should apply a different label to each continuous section of non-zero values. Is this correct?

I'm seeing the same label applied to sections that are clearly separated by zeros, seemingly just because they have the same value (which will always be 254).

Also, numLabels in the above instance returns 3, even though I verified that there are no other label values in the LabelMarker other than 0 and 254. Can anyone explain to me what's going on there?

Any help would be greatly appreciated, thanks!

0 Kudos
1 Reply
Jonghak_K_Intel
Employee
71 Views

Hi Robert, 

 Please check the below two suggestions and let us know the results. Thanks.

 First, please use a buffer size function that matches the type of your ippiLabelMarker.  ippiLabelMarkersGetBufferSize_8u_C1R -> ippiLabelMarkersGetBufferSize_16u_C1R

 Second, minLabel Minimal value of the marker label (0 < minLabel  maxLabel), maxLabel Maximal value of the marker label (minLabel  maxLabel < 255 for 8-bit markers, andminLabel  maxLabel < 65535 for 16-bit markers, and minLabel  maxLabel < (231-1) for 32-bit markers).

 - Jon

Reply