# Speed up DFT by specifying ROI in frequency domain

*Note: This question is also asked at Stack Overflow a couple of days later since this post.*

I'm building an application which extensively use dft, discrete Fourier transform. I'm trying to speed up so as to run in real-time.

In that application I only use a part of dft output specified by a rectangular ROI. My current implementation follows the steps below:

- Compute dft of the input image
*f*(typically size of 512x512) and get the entire dft result*F* - Crop
*F*into a pre-specified ROI (typically size of 32x32, located arbitrary),*R*

This process basically works well, but involves useless calculation since I only need partial information of *F*. I'm looking for a way to accelerate this calculation only by computing necessary part of dft.

I found OpenCV with Intel IPP computes dft with Intel IPP functions, which results in an order of magnitude faster than naive OpenCV implementation. I'm wondering if I can even accelerate this computation by only computing necessary frequency domain of dft.

Since I'm new to OpenCV, I've lost my way here, so I hope you could provide a way to do this.

Kindly note that I don't mean to do a dft to an ROI of an image, i.e. *dft(ROI(f))*, but I want to compute *ROI(dft(f))*.

Thanks in advance.

**EDIT**: I've got a nice answer on Stack Overflow. Refer to the URL as pointed in the main text.