How can I create a binary image with a rectangle inscribe? I am trying to modify this code for that
1 view (last 30 days)
Show older comments
[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 Comments
Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!