- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using the Canny example (slightly modified) from Taylor's book on IPP and it does not work. The following is a brief listing of my code please tell me if you need more information I can post it. Please keep in mind that I am very new to IPP and hopefully this is an obvious problem. The result of the edge detected image is shrunk to 1/3 and the colors are off. Please help!
buf_ is a LocalBuffer (another class from Taylor's book)
void image_8u::edge_detection(image_8u &source)
{
int buf_size;
IppiSize dst_size;
dst_size.width = size_.width;
dst_size.height = size_.height;
ippiCannyGetSize(dst_size, &buf_size);
int tmp_size = stride_ * dst_size.height * sizeof(Ipp16s);
buf_.SetMinAlloc(tmp_size * 2 + buf_size);
Ipp16s *pTmpX = (Ipp16s*)buf_.Alloc_8u(tmp_size);
Ipp16s *pTmpY = (Ipp16s*)buf_.Alloc_8u(tmp_size);
Ipp8u *pBuffer = buf_.Alloc_8u(buf_size);
IppStatus st;
st = ippiSobel3x3_Dx_8u16s_C1R(source.p_data_, source.stride_,
pTmpX, stride_ * sizeof(Ipp16s), dst_size);
st = ippiSobel3x3_Dy_8u16s_C1R(source.p_data_, source.stride_,
pTmpY, stride_ * sizeof(Ipp16s), IPCV_ORIGIN_BL, dst_size);
st = ippiCanny_16s8u_C1R(pTmpX, stride_ * 2, pTmpY, stride_ * 2,
p_data, stride_, dst_size, 0.0, 64.0, pBuffer);
buf_.ReleaseAll();
}
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, did you look through the forum, I remember there was a question about this function? May it help you?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks your algo helped,
my code is as follows, which works, and hope it helps someone else:
Assume that you have the input image in Ipp8u *pGData8u_, and IppiSize iSize_ with width and height given; then the function to do canny edge is as follows which returns the answer inpProsData8u_ which is assumed to be defined earlier as Ipp8u *pProsData8u_ and allocated memory
void
FindEdge(){
IppStatus st;
Ipp8u *ptemp8u_;
Ipp16s *pDerX;
Ipp16s *pDerY;
IppiSize b16sSize;
b16sSize.width = iSize_.width;
b16sSize.height= iSize_.height;
int bStride16s, iStride8u_; int buf_size;ptemp8u_ = ippiMalloc_8u_C1(iSize_.width, iSize_.height, &iStride8u_);
pDerX = ippiMalloc_16s_C1(b16sSize.width, b16sSize.height, &bStride16s);
pDerY = ippiMalloc_16s_C1(b16sSize.width, b16sSize.height, &bStride16s);
st = ippiCannyGetSize(b16sSize, &buf_size);
Ipp8u *pBuffer = ippsMalloc_8u(buf_size);;
st = ippiSobel3x3_Dx_8u16s_C1R(pGData8u_, iStride8u_,pDerX, bStride16s , b16sSize);st = ippiSobel3x3_Dy_8u16s_C1R(pGData8u_, iStride8u_,pDerY, bStride16s , IPCV_ORIGIN_TL, b16sSize);
st = ippiCanny_16s8u_C1R(pDerX, bStride16s, pDerY, bStride16s, pProsData8u_, iStride8u_, iSize_, 0.0, 64.0, pBuffer);
}- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
thanks for sharing code here, it definetely helps someone
Regards,
Vladimir
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