Extractions of image area

조회 수: 2 (최근 30일)
ELUFISAN PAUL TOMILOLA
ELUFISAN PAUL TOMILOLA 2022년 5월 3일
댓글: ELUFISAN PAUL TOMILOLA 2022년 5월 3일
I have a dataset consisting of collection of images and their bounding box information. The information shows the x,y,width and height of each of the images in the dataset. I want to extract these images based on it's bounding box information (x,y, width and height) of each images. I used imagedatastore function to load the image into Matlab environment but I'm unable to use these bounding box information to extract the image area. I can do the extraction if it is a single image but I couldn't do it for all the images in the dataset. Doing the extraction one after the other will be time consuming because of the large dataset that's is the more reason I need an automatic way of doing it one. Please your assistance and contribution will be well appreciated. Thanks

채택된 답변

Image Analyst
Image Analyst 2022년 5월 3일
Use imcrop()
for k = 1 : numFiles
thisFileName = ds.FileNames{k};
rgbImage = imread(thisFileName);
boundingBox = however you get it
croppedImage = imcrop(rgbImage, boundingBox);
end
  댓글 수: 1
ELUFISAN PAUL TOMILOLA
ELUFISAN PAUL TOMILOLA 2022년 5월 3일
Thanks so much for this timely assistance. The code worked well and was able to do what I wanted to do. Thanks a lot, i really appreciate.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by