please any one correct the code attached below

%(Image Enhancement)
image=imread('thumb.jpg');
function [final]=fftenhance(image,f)
I = 255-double(image);
[w,h] = size(I);
%out = I;
w1=floor(w/32)*32;
h1=floor(h/32)*32;
inner = zeros(w1,h1);
for i=1:32:w1
for j=1:32:h1
a=i+31;
b=j+31;
F=fft2( I(i:a,j:b) );
factor=abs(F).^f;
block = abs(ifft2(F.*factor));
larv=max(block(:));
if larv==0
larv=1;
end;
block= block./larv;
inner(i:a,j:b) = block;
end;
end;
final=inner*255;
final=histeq(uint8(final));

4 件のコメント

Sriram Tadavarty
Sriram Tadavarty 2020 年 4 月 21 日
What's the issue or error that you are facing? Can you attach the image thumb.jpg with the paperclip icon?
indrani dalui
indrani dalui 2020 年 4 月 22 日
function [final]=fftenhance(image,f)
I = 255-double(image);
error:
Error in enh (line 3)
I = 255-double(inputimage);
Ameer Hamza
Ameer Hamza 2020 年 4 月 22 日
indrani, post the complete error message.
indrani dalui
indrani dalui 2020 年 4 月 22 日
dear sir,
attached the code here with error message
%(Image Enhancement)
function [final] = fftenhance (image,f)
I = 255-double (image);
[w,h] = size(I);
%out = I;
w1=floor(w/32)*32;
h1=floor(h/32)*32;
inner = zeros(w1,h1);
for i=1:32:w1
for j=1:32:h1
a=i+31;
b=j+31;
F=fft2( I(i:a,j:b) );
factor=abs(F).^f;
block = abs(ifft2(F.*factor));
larv=max(block(:));
if larv==0
larv=1;
end;
block= block./larv;
inner(i:a,j:b) = block;
end;
end;
final=inner*255;
final=histeq(uint8(final));
end
error:
>> fftenhance
Not enough input arguments.
Error in fftenhance (line 3)
I = 255-double (image);

サインインしてコメントする。

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 4 月 22 日
編集済み: Ameer Hamza 2020 年 4 月 22 日

0 投票

You need to call the function fftenhance with an input image. For example
image = imread('pears.png'); % name of an image file
fftenhance(image, 2)
Save your function in a file named fftenhance.m, and then run the above two lines in command window.

5 件のコメント

indrani dalui
indrani dalui 2020 年 4 月 22 日
dear sir,
where am i put this line.actually i am a beginer.
Ameer Hamza
Ameer Hamza 2020 年 4 月 22 日
Indrani, create a file name fftenhance.m and save the following code in it.
%(Image Enhancement)
function [final] = fftenhance (image,f)
I = 255-double (image);
[w,h] = size(I);
%out = I;
w1=floor(w/32)*32;
h1=floor(h/32)*32;
inner = zeros(w1,h1);
for i=1:32:w1
for j=1:32:h1
a=i+31;
b=j+31;
F=fft2( I(i:a,j:b) );
factor=abs(F).^f;
block = abs(ifft2(F.*factor));
larv=max(block(:));
if larv==0
larv=1;
end;
block= block./larv;
inner(i:a,j:b) = block;
end;
end;
final=inner*255;
final=histeq(uint8(final));
end
Then close that file and run these lines in command window
image = imread('pears.png'); % name of an image file
fftenhance(image, 2)
Rik
Rik 2020 年 4 月 22 日
If you do not know this basic interaction with Matlab you will greatly benefit from doing a tutorial. The Matlab OnRamp course provided for free is usually a good start.
indrani dalui
indrani dalui 2020 年 4 月 22 日
dear sir,
when run these lines in command window this message is shown
image = imread('pears.png'); % name of an image file
fftenhance(image, 2)
Undefined function or variable 'fftenhance'.
Rik
Rik 2020 年 4 月 22 日
You need to make sure your function is on the Matlab path or in your current folder.
What does this line return as output?
clc,disp(pwd),which fftenhance -all
And what exact folder did you save the fftenhance.m file?

サインインしてコメントする。

カテゴリ

質問済み:

2020 年 4 月 21 日

コメント済み:

Rik
2020 年 4 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by