- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm trying to get edge smoothing to work with ippiResizeSqrPixel_8u_C3R (or _8u_C1R or _32f_C1R, for that matter). I'm using IPP 6.1 on Windows Vista x64. I've tried various interpolation modes combined with one of the two edge smoothing options ("IPPI_INTER_CUBIC2P_CATMULLROM | IPPI_SMOOTH_EDGE", for example), and with resize factors smaller and larger than one. For every combination I've tried, theresized image with the _EDGE flag is identical to the resized image without the _EDGE flag.
Is there something else I need to do to make this work?
Thank you.
--Carter
I'm trying to get edge smoothing to work with ippiResizeSqrPixel_8u_C3R (or _8u_C1R or _32f_C1R, for that matter). I'm using IPP 6.1 on Windows Vista x64. I've tried various interpolation modes combined with one of the two edge smoothing options ("IPPI_INTER_CUBIC2P_CATMULLROM | IPPI_SMOOTH_EDGE", for example), and with resize factors smaller and larger than one. For every combination I've tried, theresized image with the _EDGE flag is identical to the resized image without the _EDGE flag.
Is there something else I need to do to make this work?
Thank you.
--Carter
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
If destination pixel coordinate is less 0.5 (width or height)and there is not smooth flag the function does not perform this pixel.
If IPPI_SMOOTH_EDGE is set the function perfoms outer pixels with weight of original destination background.
IfIPPI_SUBPIXEL_EDGE is set the function perfoms these pixelswithout weight of dst.
So destination image size can be different with/without smoothing flags.
Thanks,
Beg
If destination pixel coordinate is less 0.5 (width or height)and there is not smooth flag the function does not perform this pixel.
If IPPI_SMOOTH_EDGE is set the function perfoms outer pixels with weight of original destination background.
IfIPPI_SUBPIXEL_EDGE is set the function perfoms these pixelswithout weight of dst.
So destination image size can be different with/without smoothing flags.
Thanks,
Beg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the reply.
If I understand you correctly, edge smoothing is not applied near the edge of the image, and is applied using different weighting depending on whether SMOOTH_EDGE or SUBPIXEL_EDGE is specified.
I'm not sure this directly relates to the problem I am encountering, but what does the "original destination background" refer to. I can think of four different image buffers of interest here: (1) the input image, (2) the original contents of the destination buffer, (3) the resized image before applying any edge smoothing, or (4) the resized image after applying edge smoothing. Does "original destination background" refer to one of these image buffers, or is it something else?
Also, does your comment about the destination image size mean that (for example) a 128x128 image resized with xFactor and yFactor both set to 0.75 could resize to something other than 96x96, depending on the smoothing flags? If so, how do I calculate the output size?
In any case, I think I may have stated my original problem unclearly. I run the sample code below with interpolation set to "IPPI_INTER_CUBIC2P_CATMULLROM", and again with interpolation set to "IPPI_INTER_CUBIC2P_CATMULLROM | IPPI_SMOOTH_EDGE", and a third time with interpolation set to "IPPI_INTER_CUBIC2P_CATMULLROM | IPPI_SUBPIXEL_EDGE". The resized images from the three runs are byte-for-byte identical. I had expected a difference.
The input image is a 128x128 RGB bitmap which comes with Windows Vista. I get similar results using (for example) your avatar image, a 60x60 JPEG.
Thank you.
--Carter
// Sample code, error checks removed to keep the size down.
const double xyFactor = 0.75;
int interpolation = IPPI_INTER_CUBIC2P_CATMULLROM | IPPI_SUBPIXEL_EDGE;
IplImage* pSrcImage = cvLoadImage( "C:\Users\All Users\Microsoft\User Account Pictures\guest.bmp", CV_LOAD_IMAGE_ANYDEPTH | CV_LOAD_IMAGE_ANYCOLOR );
IppiSize srcSize = { pSrcImage->width, pSrcImage->height };
IppiRect srcRect = { 0, 0, srcSize.width, srcSize.height };
CvSize dstSize = { srcSize.width * xyFactor, srcSize.height * xyFactor };
IppiRect dstRect = { 0, 0, srcSize.width * xyFactor, srcSize.height * xyFactor };
IplImage* pDstImage = cvCreateImage( dstSize, IPL_DEPTH_8U, pSrcImage->nChannels );
int bufsize = 0;
IppStatus status = ippiResizeGetBufSize( srcRect, dstRect, pSrcImage->nChannels, interpolation, &bufsize );
Ipp8u* pBuffer = ippsMalloc_8u( bufsize );
status = ippiResizeSqrPixel_8u_C3R( reinterpret_cast
cvSaveImage( "resized.png", pDstImage );
ippsFree( pBuffer );
cvReleaseImage( &pSrcImage );
cvReleaseImage( &pDstImage );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Carter,
I think the problem may be that alpha is zero.
Here's the formula for the smoothing algorithms taken from the documentation:
Notice that if alpha is equal to zero the results are the same regardless of the smoothing algorithm chosen (or not chosen).This function uses two variants of the edge smoothing:
IPPI_SMOOTH_EDGE - in this case DstRes = SrcSampled*(1-alpha) + DstExist*alpha;
IPPI_SUBPIXEL_EDGE - in this case DstRes = SrcSampled*(1-alpha);
where SrcSampled - source pixel after resizing, DstExist - destination pixel before resizing, DstRes - result destination pixel, alpha - weight of the edge pixel.
It is not clear to me how the value of alpha is set. I'm not positive this is the reason for the behavior you are seeing, but seems like a plausible explanation.
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
The "alpha" in the documentationis a weight of destination pixel which should be processed or not.
Not be confuzed with alpha-channel!
To seedistinct you can set shifts for example:
status = ippiResizeSqrPixel_8u_C3R( reinterpret_cast(pSrcImage->imageData), srcSize, pSrcImage->widthStep, srcRect, reinterpret_cast(pDstImage->imageData), pDstImage->widthStep, dstRect, xyFactor, xyFactor, 0.1, 0.1, interpolation, pBuffer );
Then you will see a difference on left and top edges of image.
Also it can be obtained bysetting non-zero offsets inROIs..
In fact we can control/start the interpolation from any place (non-whole pixel)
Thanks,
Beg
The "alpha" in the documentationis a weight of destination pixel which should be processed or not.
Not be confuzed with alpha-channel!
To seedistinct you can set shifts for example:
status = ippiResizeSqrPixel_8u_C3R( reinterpret_cast
Then you will see a difference on left and top edges of image.
Also it can be obtained bysetting non-zero offsets inROIs..
In fact we can control/start the interpolation from any place (non-whole pixel)
Thanks,
Beg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Carter,
I have reopened in premier the issue that matches this forum thread. It was my understanding that the behavior change you requested was part of the 7.0 release of the product. I have not heard from you if, in fact, the 7.0 release fixed this problem for you.
Please update me on the status of this issue for you.
Regards,
Paul

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page