Crop an image using coordinates
Mostrar comentarios más antiguos
I am getting a grid for an image using vertical projection.
I want to crop the image part, within the 2 of the points as one cropping image.
Can someone advice me on this?
Thanks!
4 comentarios
darova
el 2 de Nov. de 2019
What about find function? It can find index of point where y = 0
Anonymous26
el 2 de Nov. de 2019
darova
el 2 de Nov. de 2019
you have data (x,y) or only image (pixels)?
Anonymous26
el 2 de Nov. de 2019
Respuesta aceptada
Más respuestas (1)
darova
el 2 de Nov. de 2019
Here is an attempt
clc,clear
I = imread('Capture.jpeg');
I1 = im2bw(I); % convert to binary
I2 = bwareaopen(~I1,100); % remove numbers (small areas)
[row,col] = find(I2);
I3 = I2*0;
h = 1; % crop thickness
ii = row(1)+h:row(end)-h;
jj = col(1)+h:col(end)-h;
I3(ii,jj) = I2(ii,jj); % crop
I4 = bwareaopen(I3,200); % remove small areas
[L,n] = bwlabel(I4); % label image
for i = 1:4
subplot(2,2,i)
I5 = L == i; % find part of a curve
I6 = imdilate(I5,ones(5)); % highlight the part
II = cat(3,~I6,I1,I1)*255;
imshow(II) % show original image and part of a curve
end
im assuming the original image has no those circles

Categorías
Más información sobre Convert Image Type en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!