Code Block of Operates in Image Processing

I tried this:
%Take negative
%positiveImage = imread('cameraman.tif');
%negativeImage = 255 - positiveImage;
%imshow(negativeImage)
%or
1) a=imread('cameraman.tif');
d(:, :, 3) =255 - a(: ,:, 3);
d(: ,:, 2) = 255 - a(:, :, 2);
d(:, :, 1) =255 -a(:, :, 1);
imshow([a,d])
%log transformation with c=10
clc; clear all; close all;
f=imread('cameraman.tif')
g=rgb2gray(f);
c=input('Enter the constant value, c= 10');
[M,N]= size(g);
for x=1:M
for y=1:N
m= double(g(x,y));
z(x,y)= c. *log10(1+m);
end
end
imshow(f), figure, imshow(z);
%power-law with c=10, gamma=0.5
clc; clear all; close all;
RGB=imread(' cameraman.tif');
I=rgb2gray(RGB);
I=im2double(I);
[m,n]= size(I);
c=10;
g=[0.5];
for r= 1:length(g)
for p=1:m
for q=1:n
I3=(p,q) =c *I(p,q). ^ g(r);
end
end
figure, imshow(I3); title('Power law transformation'); xlabel('Gamma='), ylabel(g(r));
end
%contrast stretching
I=imread('cameraman.tif');
[m,n]=size(I);
figure, imshow(I);
minp=min(min(I));
maxp=max(max(I));
maxp=double(maxp);
minp=double(minp);
c=10;
d=255;
for i=1:m
for j=1:n
sonuc=(((d-c)/(maxp-minp))*(double(I(i,j))-minp))+c;
B(i,j)=round(sonuc);
end
end
B=uint8(B);
figure, imshow(B);

 採用された回答

Image Analyst
Image Analyst 2020 年 11 月 17 日

0 投票

In the middle of the loop, call a function that processes one image only and returns an output image. Then call sprintf() to create an output name, then call imwrite() to save the output image to that output file name.

9 件のコメント

Rooter Boy
Rooter Boy 2020 年 11 月 17 日
Sir, are take negative, log transformation,power-law transformation and contrast stretching correct? I'm not sure. Can you examine the codes?
Image Analyst
Image Analyst 2020 年 11 月 17 日
編集済み: Image Analyst 2020 年 11 月 17 日
z(x,y)= c. *log10(1+m);
and
I3=(p,q) =c *I(p,q). ^ g(r);
You cannot have a space after the dot. Just got through the syntax errors one by one until they're all gone. Also, you can't have two equals signs on the line like you did.
Rooter Boy
Rooter Boy 2020 年 11 月 17 日
I guess there is no other mistake than these.
I fixed form:
z(x,y)=c.*log10(1+m);
I3=(p,q)=c*I(p,q).^g(r);
Rooter Boy
Rooter Boy 2020 年 11 月 17 日
編集済み: Rooter Boy 2020 年 11 月 17 日
Sir, I guess used the filters correctly.
Rooter Boy
Rooter Boy 2020 年 11 月 17 日
編集済み: Rooter Boy 2020 年 11 月 17 日
I wonder if I use the filters correctly. If the filters here are correct, so that i would be glad if you check the filters here: https://www.mathworks.com/matlabcentral/answers/650728-filters-main-function-in-image-processing?s_tid=srchtitle
Image Analyst
Image Analyst 2020 年 11 月 18 日
If you still have trouble, post the latest code.
Rooter Boy
Rooter Boy 2020 年 11 月 18 日
I am not having problems right now, I would be glad if you look at the other question I posted.
Rooter Boy
Rooter Boy 2020 年 11 月 18 日
編集済み: Rooter Boy 2020 年 11 月 19 日
Sir, could you help me when you are available? you are professional at matrix operates in matlab.
Image Analyst
Image Analyst 2020 年 11 月 19 日
Sorry, I don't know much about that topic and don't understand what or why you think something's wrong with the code.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by