views:

49

answers:

1

I wish to apply a frequency-domain filter, such as a Low Pass or Band Pass, to each horizontal line of an image. Is this possible using opencv?

+1  A: 

I think that you will need to elaborate more on your questions. Perhaps, giving some concrete examples.

If I interpret your question as:

You have an image with say 10 x 10

line 1

line 2

line 3 ...

line 10

You want to apply some filter (Low Pass/Band Pass) on these lines independently.

Then, first you need to design your horizontal filters (in whatever tool you want).

Let's assume (without loss of generality) that you have 2 filters:

Low pass: 1x10 image

Band pass: 1x10 image

Then you can use cv::dft to convert these filters into frequency domain. Also use cv::dft to convert your image into frequency domain. Of course, you should convert individual rows separately. One way to do this is:

cv::Mat im = cv::imread('myimage.jpg', 1);
cv::Mat one_row_in_frequency_domain;
for (int i=0; i<im.rows; i++){
  cv::Mat one_row = im.row(i);
  cv::dft(one_row, one_row_in_frequency_domain);

  // Apply your filter by multiplying
}
Dat Chu