How can I crop a set of non-binary images automatically depending on the size and position of each image?
1 次查看(过去 30 天)
显示 更早的评论
I have a dataset of more than 1000 images. When I load them into Matlab (R2021b), they all are the same size, but the actual image information is stored differently in them, because they are padded unequally (I cannot supply image examples since they consist of medical data).
Is there any way to perform this kind of heterogeneous cropping automatically? Is there any function that I have missed in my research? I have already checked imcrop and regionprops, but they do not offer what I need I think. Here you have a schematic representation of my problem:
I would like to crop the white areas and keep the images only without manually specifying the coordinates and the positions of the cropping.
Many thanks in advance,
0 个评论
采纳的回答
DGM
2022-2-3
编辑:DGM
2022-2-4
If the excess area is a solid color (you mentioned white), then I and ImageAnalyst mention multiple methods in this thread:
Note the limitations of each.
If the padding area has other stuff in it (e.g. text labels, ui controls), the process may need to be more involved, perhaps resorting to simple image segmentation to find the cropping coordinates.
If there isn't really a distinct padded area, but just a shift in the region of interest within a large image area, then you'll need to come up with a means of programmatically identifying the ROI.
0 个评论
更多回答(1 个)
yanqi liu
2022-2-7
yes,sir,may be use image segment method,such as locate image rectangle,and then make it as logical mask matrix,then apply it to origin image to crop it
if possible,may be upload your some image to analysis
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!