Borrar filtros
Borrar filtros

How can I create a binary image with a rectangle inscribe? I am trying to modify this code for that

1 visualización (últimos 30 días)
[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)

Respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by