이 제출물을 팔로우합니다
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다
Rotateim.m
This function reads an (transparent) image and rotates it by theta degrees.
Features
- No toolbox required
- Read and rotate transparent/intransparent image
- Scale image size up/down
- Crop
Syntax
[imR,alphaR] = rotim(im,theta,bgColor,crop,scale,interpMethod)
INPUT:
im: a) image file name
b) struct with two fields, im.rgb image and im.alpha
im.rgb: height * width * (1 or 3), either 0-255 uint8 or 0-1 double
im.alpha: height * width, either 0-255 uint8 or 0-1 double
theta: Amount of rotation in degrees
bgColor: Color of the given background.
Optional, place holder: NaN
Default: [128, 128, 128]
Integer numbers in the range 0-255
Example: [255 255 0] for yellow
Color of some pixels at the opaque border of the rotated small image.
Those pixels come up by rotating the small image, especially visible with very small
images.
Perfect result is when S.’bgColor’ is the same RGB color as the background.
crop: crop image. Optional, default: no crop
true: crop transparent areas
false: no crop, default
scale: a scalar factor that scales (shrinks or enlarges) the image. Optional, default=1, no scaling
No antialiasing is invoked by changing the scale
interpMethod:
'nearest' - nearest neighbor interpolation, sometimes better for very small images
'linear' - bilinear interpolation (default), recommended
'cubic' - bicubic interpolation
OUTPUT:
imR: Rotated image as RGB values
alphaR: Rotated transparency
Remark:
To increase speed at multiple calls of rotim, some data is stored as peristent data.
Therefore, when the image content has changed, but not the image name, call
imrot without any argument to reset persistent data.
Example:
imshow(rotim('corn.tif',33))
See also enclosed "readMeRotateIm.pd"'.
인용 양식
Peter Seibold (2026). Read and rotate transparent or intransparent image (https://kr.mathworks.com/matlabcentral/fileexchange/180599-read-and-rotate-transparent-or-intransparent-image), MATLAB Central File Exchange. 검색 날짜: .
