how to crop aportion of an image from in bounding box.?
조회 수: 3 (최근 30일)
이전 댓글 표시
i use open source code in the link https://www.mathworks.com/help/vision/examples/automatically-detect-and-recognize-text-in-natural-images.html to detect text and finally i get an image like below with more than one bounding box and i need to crop each of the bounding box.i know imcrop with for loop can do this.plaese help me?
textBBoxes = [xmin ymin xmax-xmin+1 ymax-ymin+1];
textBBoxes = [xmin ymin xmax-xmin+1 ymax-ymin+1];
numRegionsInGroup = histcounts(componentIndices);
textBBoxes(numRegionsInGroup == 1, :) = [];
ITextRegion = insertShape(colorImage, 'Rectangle', textBBoxes,'LineWidth',3);
figure imshow(ITextRegion) title('Detected Text')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163605/image.jpeg)
end
댓글 수: 0
채택된 답변
Image Analyst
2017년 5월 1일
Loop over all boxes, calling imcrop() while passing it the rectangle (xLeft, yTop, width, height] for the box.
댓글 수: 2
Image Analyst
2017년 5월 2일
text() is a built-in function - don't use that. Also textBBoxes should be an N by 4 array of doubles, not text. Finally, you need to have the K index with textBBoxes when you send it into imcrop().
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!