필터 지우기
필터 지우기

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,

채택된 답변

DGM
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.

추가 답변 (1개)

yanqi liu
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

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by