The meaning of code on this program
1 回表示 (過去 30 日間)
古いコメントを表示
Hi.
That is a code which produce a difference picture on Matlab.
That is my professor code, but i cannot fully understand.
The knowledge point is image on Matlab.
% read an image: imread()
% show an image: imshow()
% eg.
clear, close all
I = imread('pout.tif'); % read
for i = 1:size(I,1)
for j = 1:size(I,2)
if (rem(i,2)==0 && rem(j,2)==0)
I(i,j) = 0;
end
end
end
% show a image
imshow(I);
What is the meaning of i = 1:size(I,1) and what is the purpose of rem(i,2) == 0 && rem(j,2) == 0;
Thank you all.
0 件のコメント
採用された回答
KSSV
2022 年 3 月 26 日
clear, close all
I = imread('pout.tif'); % this is to read the image pout.tif
for i = 1:size(I,1) % this is loop from 1 to number of rows of the image (REad abou the fnction size)
for j = 1:size(I,2) % this is loop from 1 to number of columns of the image. So basically the loops cover each pixel of the image i.e. each and every element of matrix
if (rem(i,2)==0 && rem(j,2)==0) % if the row, collumn is even
I(i,j) = 0; % repalce the pixel by 0
end
end
end
You can try yourself everything instead of asking a question. Read the documentation of rem.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!