Hello everyone,
I am just getting into matlab and and working through some projects for digitam image processing. I wrote some matlab code to filter in the frequency domain but when I plot my image at multiple points I am getting issues from the expected results. I believe the issues are plotting and data type related and wanted to get some feedback on how to do things better.
I need to accomplish the following:
  1. Given an input f(x,y) of size M x N obtain the padding sizes P and Q. P = 2M, Q = 2N.
  2. Form a padded image fp(x,y) of size P x Q using zero padding.
  3. Center the image using fp(x,y) * (-1)^(x+y)
  4. Compute the DFT F(u,v) of the image from step 3.
  5. Construct a real symmetric filter transfer function H(u,v) of size P x Q with center at (P/2, Q/2).
  6. Form the product G(u,v)=G(u,v)*H(u,v) using element wise multiplication.
  7. Obtain the filtered image by computing the IDFT of G(u,v), and decenter the image. gp(x,y) = (real[IDFT{G(u,v)}])*(-1)^(x+y)
  8. Obtain the final filtered result g(x,y) of the same size as the input image by extracting the M x N region from the top, left quadrant of gp(x,y).
I have written the following code to filter my image and accomplish the steps above (thanks to lots of helpful answers on this website).
Question:
In my figure F_uv_dftImage I should see a periodic frequency spectrum. I can but I need to zoom in really close currently to see a tiny image. In the book im using they show this a lot more clearly. Am I using the wrong data types throughout my code (double) to get the results? Or am I just plotting these graphs in the wrong way to display the data? Any input would be great!
If you want to see my code please just message me directly.

댓글 수: 1

Uzair Muhammad
Uzair Muhammad 2020년 3월 31일
can you please share the code. thanks in advance
Email : uzairali398@gmail.com

댓글을 달려면 로그인하십시오.

 채택된 답변

Aleksander Banbur
Aleksander Banbur 2019년 9월 28일

0 개 추천

I solved my problem. In order to plot the DFT properly you need to scale it logarithmically. You can use the log transformation which is s = c*log(1+r) where r is the input DFT image normalized (r=DFT_Image/255), c is a constant, and s is your new log scaled image which you can plot. This fixed all my issues.

추가 답변 (1개)

alo halo
alo halo 2019년 12월 15일

0 개 추천

I cannot find the direct message option. Can you please share your code with me?

카테고리

도움말 센터File Exchange에서 Blue에 대해 자세히 알아보기

제품

릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by