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!