- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hello,
I wanted to do a function that segment a grayscale image, but it seems that the number of resulting labels is always 1 for my function. I think the problem comes from the fact that I have only a few '0' in my grayscale source image. Does it means that I need to preprocess my picture before segmenting with IPP? How have I done an error?
Here is my code:
IplImage* Segmentation(IplImage* pcv_GrayImg)
{
CvSize cv_Size;
IppiSize RoiSize;
int bufferSize, numLabels;
int minLabel = 1;
int maxLabel = 254;
cv_Size.height = pcv_GrayImg->height;
cv_Size.width = pcv_GrayImg->width;
IplImage* pcv_SegImg = cvCreateImage( cv_Size, 8, 1 );
RoiSize.width = pcv_GrayImg->width;
RoiSize.height = pcv_GrayImg->height;
ippiLabelMarkersGetBufferSize_8u_C1R(RoiSize, &bufferSize);
Ipp8u* buffer = ippsMalloc_8u(bufferSize);
ippiLabelMarkers_8u_C1IR((Ipp8u*) pcv_GrayImg->imageData, pcv_GrayImg->widthStep, RoiSize, minLabel, maxLabel, ippiNormInf, &numLabels, buffer);
printf("Numlabels: %d\\n",numLabels);
...
}
Thanks for your help!
I wanted to do a function that segment a grayscale image, but it seems that the number of resulting labels is always 1 for my function. I think the problem comes from the fact that I have only a few '0' in my grayscale source image. Does it means that I need to preprocess my picture before segmenting with IPP? How have I done an error?
Here is my code:
IplImage* Segmentation(IplImage* pcv_GrayImg)
{
CvSize cv_Size;
IppiSize RoiSize;
int bufferSize, numLabels;
int minLabel = 1;
int maxLabel = 254;
cv_Size.height = pcv_GrayImg->height;
cv_Size.width = pcv_GrayImg->width;
IplImage* pcv_SegImg = cvCreateImage( cv_Size, 8, 1 );
RoiSize.width = pcv_GrayImg->width;
RoiSize.height = pcv_GrayImg->height;
ippiLabelMarkersGetBufferSize_8u_C1R(RoiSize, &bufferSize);
Ipp8u* buffer = ippsMalloc_8u(bufferSize);
ippiLabelMarkers_8u_C1IR((Ipp8u*) pcv_GrayImg->imageData, pcv_GrayImg->widthStep, RoiSize, minLabel, maxLabel, ippiNormInf, &numLabels, buffer);
printf("Numlabels: %d\\n",numLabels);
...
}
Thanks for your help!
コピーされたリンク
1 返信
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Please take a look at this thread, similar problem.
http://software.intel.com/en-us/forums/showthread.php?t=65142
http://software.intel.com/en-us/forums/showthread.php?t=65142