How can I make automatic crop?
1 次查看(过去 30 天)
显示 更早的评论
Hello
How can I make automatic crop around core? like
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/191456/image.jpeg)
.
2 个评论
Rik
2018-6-24
Have a read here (or here for more general advice) and here. It will greatly improve your chances of getting an answer.
采纳的回答
Image Analyst
2018-6-24
Why do you need to crop it?
Anyway, if you do for some reason, you can just binarize and look for the min and max row and column.
binaryImage = imbinarize(grayImage);
[rows, columns] = find(binaryImage);
row1 = min(rows);
row2 = max(rows);
col1 = min(columns);
col2 = max(columns);
croppedGrayImage = grayImage(row1:row2, col1:col2);
imshow(croppedImage);
5 个评论
Image Analyst
2018-6-24
编辑:Image Analyst
2018-6-24
Well there's the problem. You totally ignored my code in my answer, and did it your own (wrong) way. Why?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!