Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

[Question] Intel Ipp Median

Myeong-Gu_J_
Beginner
674 Views

Hi all.

I have a question. The code below is image processing for median filter in real-time.

But, after median processing the image comes with a diagonal  as shown in Fig 1.

Try to solve this part, fix the below source.

But, the Image is broken. as shown in Fig.2.

So, after processing median filter,  I want to get the image without diagonal.

For reference, I was using Intel IPP 7.1.

Please ask for advice.


Thank you.

===============================source code=====================================

IppiSize maskSize = {3, 3};

IppiPoint anchor = {1, 1};

IppiSize sizeSrc  = {W_Image, H_Image}; //W_Image : 750, H_Image :800

IppiSize sizeDst = {W_Image, H_Image};

IppiSize  szFiltter = {W_Image-2, H_Image-2};   int nStepSrc = (8 *  sizeSrc.width + 31) / 32 * 4; //Width a multiple of 4.

int nStepDst = (8 * sizeDst.width + 31) / 32 * 4; // //Width a multiple of 4.

IppStatus status = ippStsNoErr; Ipp8u*  pipSrcROI = (Ipp8u*)(((Ipp8u*)m_Pixel) + anchor.y * nStepSrc + anchor.x *  sizeof(Ipp8u) * 3);

//m_Pixel : 752H(real 750H) x 800V x 1byte, raw data from image sensor

 Ipp8u* pipDstROI =  (Ipp8u*)(((Ipp8u*)p) + anchor.y * nStepDst + anchor.x * sizeof(Ipp8u) * 3);

 //p :752H(real 750H) x 800V x 1byte, print to Monitor

//Median Processing

status = ippiFilterMedian_8u_C1R(pipSrcROI, nStepSrc,  pipDstROI, nStepDst, szFiltter, maskSize, anchor);  

for(int j = 0; j < H_Image; j++)

{  

  for(int i = 0; i < widthbytes;  i++) //W_Image : 750, H_Image :800, widthbytes : 752

 {

   if(i < W_Image) //0~749: Real Raw Data,  750~751 : dummy  

   {   

       *(p_2 + (i + (j *  widthbytes))) = *(p+(i + (j *  W_Image)));  

    }  

   else   

    {    

       *(p_2  + (i + (j* widthbytes))) = (unsigned  char)0;  

     }  

   }

 }

dc = GetDC(GetDlgItem(hDlgMain,  IDC_STATIC_PICTURE));

SetDIBitsToDevice(dc,Rect.left,Rect.top,W_Image,H_Image,0,0,0,H_Image,p_2,BmInfo,DIB_RGB_COLORS);

InvalidateRect(hDlgMain,NULL,FALSE);

ReleaseDC(GetDlgItem(hDlgMain,  IDC_STATIC_PICTURE), dc);

=============================================================================

0 Kudos
8 Replies
Myeong-Gu_J_
Beginner
674 Views

Here Fig1,2 ..

0 Kudos
SergeyKostrov
Valued Contributor II
674 Views
I don't think this is a problem with IPP median filter function. >>... >>... *(p_2 + (i + (j* widthbytes))) = ( unsigned char )0; >>... Could you explain what's that line for?
0 Kudos
Myeong-Gu_J_
Beginner
674 Views

0  ~ 749 : real pixel

 750 ~751 : dummy pixel

0 Kudos
SergeyKostrov
Valued Contributor II
674 Views
>>>>... *(p_2 + (i + (j* widthbytes))) = ( unsigned char )0; Don't you see that you have a code which sets to zero some pixels?
0 Kudos
Myeong-Gu_J_
Beginner
674 Views

The width is 750pixel. Not a multiple of 4. so, make a multiple of 4. then width is 752 pixel. if not width a multiple of 4, can't be displayed on the monitor.

0 Kudos
Myeong-Gu_J_
Beginner
674 Views

The width is 750pixel. Not a multiple of 4. so, make a multiple of 4. then width is 752 pixel. if not width a multiple of 4, can't be displayed on the monitor.

0 Kudos
SergeyKostrov
Valued Contributor II
674 Views
>>...So, after processing median filter, I want to get the image without diagonal... Here is what I'd like you to do: Comment Out that line of code: ... //*(p_2 + (i + (j* widthbytes))) = ( unsigned char )0; ... and repeat your test.
0 Kudos
Myeong-Gu_J_
Beginner
674 Views

Solved.

int nStepSrc = (8 * sizeSrc.width + 31) / 32 * 4; to  int nStepSrc = 750; //750 : real width

int nStepDst = (8 * sizeDst.width + 31) / 32 * 4;to int nStepDst = 750; //750 : real width

Thank you for the advice!

0 Kudos
Reply