Rotate images with automatic cropping

버전 1.0 (4.2 KB) 작성자: David Young
The blank triangles that appear in the corners of rotated images are cropped away.
다운로드 수: 891
업데이트 날짜: 2014/12/2

라이선스 보기

When an image is rotated, using imrotate() for example, blank triangles appear in the corners of the output unless it is reduced in size. The triangles are the parts of the output image that correspond to regions outside the boundary of the input image. This function rotates an image about its centre using imrotate(), then crops the result sufficiently to remove the triangles. Of course, some data in the corners of the original image is lost.
By default the output has the maximum possible area (i,e,. number of pixels) and the crop is symmetrical, so the centre of the output is at the centre of the input image. In this case the function takes the same arguments as imrotate().
Optionally, the aspect ratio of the output may be set to a given value, or to be the same as that of the input. It may also be set so that the corners of the output all lie on the rotated sides of the input, though this is not always possible. In general, if the aspect ratio is set the cropped image will not have the maximum possible area.
When the position of the output is not fully constrained it may optionally be adjusted by a single parameter which sets the position of the centre of the output on the long axis of the rotated input.
Note that if you are using a version of MATLAB older than R2013b you will need to replace any calls to the addParameter method of the input parser with addParamValue.

인용 양식

David Young (2024). Rotate images with automatic cropping (https://www.mathworks.com/matlabcentral/fileexchange/48624-rotate-images-with-automatic-cropping), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2014b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0