我有一个 RGB 图像,我试图找出这个图像是聚焦还是失焦。一开始我做了一个 2D FFT,但是当我绘制径向光谱时,在焦点上的图像和失焦的图像之间没有明显的区别。有人告诉我要使用图像的衍生物,但是当我绘制这个新光谱时,结果看起来不像我预期的那样。因为是更大程序的一部分,我这里写的是伪代码,这不是完整的程序
%read the file and the part of the image I am working on
file='test1.jp2'
image_part=imread(file,'PixelRegion',{[xpixmin xpixmax],[ypixmin ypixmax]});
%derivatives
dx=diff(double(image_part),1,1);
dy=diff(double(image_part),1,2);
........
created tapers with Slepian sequences (dpss), multiplied with dx and dy and
then new outcome is tap_dx,tap_dy
.......
%FFT
fft2_dx=fft2(tap_dx)
fft2_dy=fft2(tap_dy)
%magnitude and fftshift
fft2_abs_dx=fftshift(abs(fft2_dx))
fft2_abs_dy=fftshift(abs(fft2_dy))
%to take the radial spectrum average the Fourier spectrum over the different
frequencies(fr)
avg_dx=mean(fft2_abs_dx(fr))
avg_dy=mean(fft2_abs_dy(fr))
plot(fr,avg_dx+avg_dy)
在我做导数之前,径向图从最大值开始,然后以单调的方式下降到最小值。当我绘制导数时,虽然径向图从最大值开始然后到最小值,然后它再次增加,这似乎不正确。有没有人尝试使用这种技术来确定图像是聚焦还是失焦。我还没有找到任何相关的参考资料。
该项目的目的不是校正图像的焦点,而是确定图像是否失焦以及是否使用自动方式拒绝它。
先感谢您。