필터 지우기
필터 지우기

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개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by