[Question] Intel Ipp Median

[Question] Intel Ipp Median

imagem de Myeong-Gu J.

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);

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

9 posts / 0 new
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.
imagem de Myeong-Gu J.

Here Fig1,2 ..

Anexos: 

AnexoTamanho
Download fig.1.png253.41 KB
Download fig.2.png258.16 KB
imagem de Sergey Kostrov

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?

imagem de Myeong-Gu J.

0  ~ 749 : real pixel

 750 ~751 : dummy pixel

imagem de Sergey Kostrov

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

Don't you see that you have a code which sets to zero some pixels?

imagem de Myeong-Gu J.

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.

imagem de Myeong-Gu J.

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.

imagem de Sergey Kostrov

>>...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.

imagem de Myeong-Gu J.

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!

Faça login para deixar um comentário.