Cropping the image with boundary condition
조회 수: 2 (최근 30일)
이전 댓글 표시
I am tracking an object in an image. Once the object is located i am cropping the image of size 120*60 using
crop1=imcrop(image,[x1-30,y1-50,60,120])
The issue is when its near the boundary, the cropped image size get reduced and i am shorter(y axis) or thinner (x axis)cropped images.
댓글 수: 0
채택된 답변
Image Analyst
2017년 12월 5일
If the image is smaller because some part of the cropped image would lie off the original image, then you can paste the smaller part onto a matrix of zeros that is the full size. See my copy and paste demo.
댓글 수: 0
추가 답변 (1개)
Elizabeth Reese
2017년 12월 5일
If any of these values are outside of the range of pixels that the image actually inhabits, than the resulting image will looked more cropped than expected. So if the xmin or ymin are negative, then the resulting image will not be the whole 60x120 size.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!