How can I crop between 2 verticle lines in an image
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Mattinator
el 3 de Jul. de 2018
Respondida: Constantino Carlos Reyes-Aldasoro
el 5 de Jul. de 2018
I am able to detect the vertical lines of the image using the example from https://uk.mathworks.com/help/images/hough-transform.html. However I need to select 2 specific vertical lines and then crop to leave the image of only what's between them. This is because I have lots of similar images, about 150, and am currently having to manually crop each picture.
Any help would be greatly appreciated!
2 comentarios
Image Analyst
el 3 de Jul. de 2018
Usually people attach the image and code when they ask for image processing advice. Without that about all I can say is to extract/crop the image between line1 and line2 do this:
croppedImage = yourImage(line1:line2, :, :);
Respuestas (1)
Constantino Carlos Reyes-Aldasoro
el 5 de Jul. de 2018
This should be rather simple if you find edges, you could use hough or alternatively canny, so try something like
image7 = imread('/Users/ccr22/Desktop/image 7.jpg'); a=edge(image7(150:300,:,1),'canny',[],3); plot(sum(a))
This will detect edges along your image, then you can add them over the vertical dimension and this will produce a series of peaks where your lines of interest exist (notice that I cropped top and bottom where there are some distracting lines). Use findpeaks to detect the peaks and with find you can determine the position along the axis. Then crop as in the above comment.
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!