Cropping an irregular shaped object
조회 수: 5 (최근 30일)
이전 댓글 표시
Is there any way to crop the irregular shape object so that we can gwt only the pixels of the irregular shaped object?
I have tried imfree hand to get the irregular shaped object,but in this case the remaining pixels of the image are also present with zero values .I dont need the remaining pixels with Nan and zero values.
댓글 수: 0
답변 (1개)
Raunak Gupta
2019년 12월 6일
Hi,
Returning a cropped image will remove the context of information present in the original image while drawing the irregular shape. Currently it is not supported with imfreehand. If it is required to return a cropped image from the image you are currently getting, you may try to remove trailing and leading rows and column with zero value from the image by following the method explained here.
Note the mentioned answer works for grayscale images but If you want to work on color images, I suggest taking average of three channels since the zero values in color image will remain zero here. Applying above method to this 1-channel image will give bounding box which is the effective size of the image that is required. Then imcrop can be used once size of rectangle is extracted on the original image.
Hope this helps.
댓글 수: 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!