How can I create a binary image with a rectangle inscribe? I am trying to modify this code for that
1 回表示 (過去 30 日間)
古いコメントを表示
[Length, Width] = size(imagen);
r = 0.3
B = zeros(Length, Width);
for i = 1:Width % top to bottom
for j = 1:Length %left to right
H =sqrt((i - 0.5*Width)^2 + (j - 0.5*Width)^2);
% Defines a Circle ^
if(H<=r*Width);
B(i,j)=Length;
else
B(i,j)= 0;
end
end
end
figure(6)
imshow(B);
Im_B1 = double(imagen).*(B);
figure()
imshow(Im_B1)
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!