How can I crop between 2 verticle lines in an image
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
Image Analyst
2018 年 7 月 3 日
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, :, :);
回答 (1 件)
Constantino Carlos Reyes-Aldasoro
2018 年 7 月 5 日
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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!