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

FFT data manipulation

enricbosch2002
Beginner
720 Views
Hello,
I would like to make a mask of FFT image to obtain information in some frequency bands.
The iplRealFft2D or ippiFFTFwd give me the coeficients of the FFT in the RCPack 2D mode. I don't know how to get a similar image matrix (352x288) with FFT fourier coeficients.
I would be very grateful if youcould help me.
Enric
0 Kudos
3 Replies
Vladimir_Dudnik
Employee
720 Views

Hi Enric,

You can use the following functons to data from RCPack format

Code:

/* /////////////////////////////////////////////////////////////////////////////
//  Name:           ippiPackToCplxExtend
//
//  Purpose:        Converts an image in RCPack2D format to a complex data image.
//
//  Returns:
//      ippStsNoErr            No errors
//      ippStsNullPtrErr       pSrc == NULL, or pDst == NULL
//      ippStsStepErr          One of the step values is less zero or negative
//      ippStsSizeErr          The srcSize has a field with zero or negative value
//
//  Parameters:
//    pSrc        Pointer to the source image data (point to pixel (0,0))
//    srcSize     Size of the source image
//    srcStep     Step through  the source image
//    pDst        Pointer to the destination image
//    dstStep     Step through the destination image
//  Notes:
*/

IPPAPI (IppStatus, ippiPackToCplxExtend_32s32sc_C1R, (const Ipp32s* pSrc,
        IppiSize srcSize, int srcStep,
        Ipp32sc* pDst, int dstStep ))

IPPAPI (IppStatus, ippiPackToCplxExtend_32f32fc_C1R, (const Ipp32f* pSrc,
        IppiSize srcSize, int srcStep,
        Ipp32fc* pDst, int dstStep ))


Regards,
Vladimir

0 Kudos
enricbosch2002
Beginner
720 Views
Thank you for the answer.
I have a sample image and I use some ipp, ipl and opencv fuctions to obtain theFFT coeficients.INTENTFFT_MAG_8.JPG is the result of FFT coeficients, but i don't know if it's correct .
The result of the FFT coeficients of a white image (352 x 288) is strange. It's the code correct ?
I want to otain an image that show me the frequency components, but I don't know if it's wrong or I don't know how to interpretate the result.

IplImage* SRC = cvLoadImage("INTENT_4.JPG",0); //Gray image

cvSaveImage("SRC.JPG",SRC);

IplImage* INTENT_GRAY32= cvCreateImage( cvGetSize(SRC),IPL_DEPTH_32F,1);

cvConvertScale(SRC,INTENT_GRAY32, 1 , 0 );

cvSaveImage("INTENT_FRAME_GRAY32.JPG",INTENT_GRAY32);

IppiSize INTENTSIZE = {INTENT_GRAY32->width,INTENT_GRAY32->height};

CvSize EXTEND ={2*SRC->width, 2*SRC->width};

IplImage* INTENTFFT=cvCreateImage(cvGetSize(SRC),IPL_DEPTH_32F,1);

IplImage* INTENTResult=cvCreateImage(cvGetSize(SRC),IPL_DEPTH_8U,1);

IplImage* INTENTIFFT=cvCreateImage(cvGetSize(SRC),IPL_DEPTH_32F,1);

iplRealFft2D(INTENT_GRAY32,INTENTFFT,IPL_FFT_Forw);

IplImage* INT_M=cvCreateImage(EXTEND,IPL_DEPTH_32F,1);

ippiPackToCplxExtend_32f32fc_C1R((Ipp32f*)INTENTFFT->imageData,

INTENTSIZE,INTENTFFT->width*

sizeof(Ipp32f),(Ipp32fc*)INT_M->imageData,

INT_M->width*

sizeof(Ipp32fc));

IplImage* INTENTFFT_8=cvCreateImage(cvGetSize(INT_M),IPL_DEPTH_8U,1);

cvConvert(INT_M,INTENTFFT_8);

cvSaveImage("INTENTFFT_8.JPG",INTENTFFT_8);

IplImage* INTENTFFT_MAG=cvCreateImage(cvGetSize(INT_M),IPL_DEPTH_32F,1);

IplImage* INTENTFFT_MAG_8=cvCreateImage(cvGetSize(INT_M),IPL_DEPTH_8U,1);

ippiMagnitudePack_32f_C1R((Ipp32f*)INTENTFFT->imageData,

INTENTFFT->width*

sizeof(Ipp32f), (Ipp32f*)INTENTFFT_MAG->imageData,

INTENTFFT_MAG->width*

sizeof(Ipp32f), INTENTSIZE);

cvConvert(INTENTFFT_MAG,INTENTFFT_MAG_8);

cvSaveImage("INTENTFFT_MAG_8.JPG",INTENTFFT_MAG_8);

0 Kudos
andrewk88
Beginner
720 Views

Enric,

You may find the thread link below to be of interest

http://softwareforums.intel.com/ids/board/message?board.id=IPP&message.id=1156&query.id=5983#M1156

Best regards,
Andrew
0 Kudos
Reply