Can somebody explain the following code ?

조회 수: 2 (최근 30일)
Sahil khandelwal
Sahil khandelwal 2022년 5월 21일
댓글: Walter Roberson 2022년 5월 22일
Please explain the following code.
sout=imresize(inp,[256,256]);
t0=60;
th=t0+((max(inp(:))+min(inp(:)))./2);
for i=1:1:size(inp,1)
for j=1:1:size(inp,2)
if inp(i,j)>th
sout(i,j)=1;
else
sout(i,j)=0;
end
end
end

답변 (1개)

dpb
dpb 2022년 5월 21일
편집: dpb 2022년 5월 22일
Just turns into binary image at the threshold value, th
NB; the double loop construct in MATLAB should be written as vector logical operation and convert the result from a logical array to the same as the input array.
t0=60;
th=t0+mean([max(inp,[],'all') min(inp,[],'all']));
sout=(inp>th);
  댓글 수: 10
Michael Van de Graaff
Michael Van de Graaff 2022년 5월 22일
why is this question tagged with 'brain-tumor'?
Walter Roberson
Walter Roberson 2022년 5월 22일
The poster was providing a bit of context for the code, which is information that might potentially have helped readers understand the code better.

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

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by