Can somebody explain the following code ?
1 回表示 (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (1 件)
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 件のコメント
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.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!