- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Suppose I have a imageA, now I want it have the duplicate border, for example, copy the data from the second row to the first row, copy the data from the last but one row to the last row, copy the second column to the first colum, copy the last but one column to the last colum.
In opencv, it is very simple
image.row(1).copyTo(image.row(0));//copy 2nd row to first row
image.row(nx).copyTo(image.row(nx+1));//copy last but one row to the last row
image.col(1).copyTo(image.col(0)); //copy last but one column to the last column
image.col(ny).copyTo(image.col(ny+1));//copy last but one column to the last column
So I dont knwo if there is a efficient way to do same thing using IPP ?
Thanks !
Stella
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Stella,
I believe more proper way to make border in OpenCV is like this:
cv::Mat srcSub = cv::Mat(src, cv::Rect(1, 1, src.size().width - 2, src.size().height - 2)); // Create submatrix which points to image inside border cv::copyMakeBorder(srcSub, src, 1, 1, 1, 1, BORDER_REPLICATE);
In IPP there are similar functions, e.g.:
IppiSize srcSize = {width-2, height-2}; // Size of image inside border IppiSize dstSize = {width, height}; // Full size with border pSrc = (Ipp8u*)pSrc + srcDstStep + elemSize; // Shift pointer to be inside border ippiCopyReplicateBorder_8u_C1IR_L(pSrc, srcDstStep, srcSize, dstSize, 1, 1);
This will replicate border rows/columns in the same image. This example is for 8u C1 data with 1px border for every side.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Stella,
I believe more proper way to make border in OpenCV is like this:
cv::Mat srcSub = cv::Mat(src, cv::Rect(1, 1, src.size().width - 2, src.size().height - 2)); // Create submatrix which points to image inside border cv::copyMakeBorder(srcSub, src, 1, 1, 1, 1, BORDER_REPLICATE);
In IPP there are similar functions, e.g.:
IppiSize srcSize = {width-2, height-2}; // Size of image inside border IppiSize dstSize = {width, height}; // Full size with border pSrc = (Ipp8u*)pSrc + srcDstStep + elemSize; // Shift pointer to be inside border ippiCopyReplicateBorder_8u_C1IR_L(pSrc, srcDstStep, srcSize, dstSize, 1, 1);
This will replicate border rows/columns in the same image. This example is for 8u C1 data with 1px border for every side.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Pavel,
Thanks for your reply. I believe you give me the correct answer.
I will try then.
Thanks,
Stella
Pavel V. (Intel) wrote:
Hi Stella,
I believe more proper way to make border in OpenCV is like this:
cv::Mat srcSub = cv::Mat(src, cv::Rect(1, 1, src.size().width - 2, src.size().height - 2)); // Create submatrix which points to image inside border cv::copyMakeBorder(srcSub, src, 1, 1, 1, 1, BORDER_REPLICATE);In IPP there are similar functions, e.g.:
IppiSize srcSize = {width-2, height-2}; // Size of image inside border IppiSize dstSize = {width, height}; // Full size with border pSrc = (Ipp8u*)pSrc + srcDstStep + elemSize; // Shift pointer to be inside border ippiCopyReplicateBorder_8u_C1IR_L(pSrc, srcDstStep, srcSize, dstSize, 1, 1);This will replicate border rows/columns in the same image. This example is for 8u C1 data with 1px border for every side.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page