Skip to content

rotate_imageRotateImageRotateImagerotate_imagerotate_image🔗

Short description🔗

rotate_imageRotateImageRotateImagerotate_imagerotate_image — Rotate an image about its center.

Signature🔗

rotate_image( image Image, out image ImageRotate, angle.deg Phi, string Interpolation )void RotateImage( const HObject& Image, HObject* ImageRotate, const HTuple& Phi, const HTuple& Interpolation )static void HOperatorSet.RotateImage( HObject image, out HObject imageRotate, HTuple phi, HTuple interpolation )def rotate_image( image: HObject, phi: Union[int, float], interpolation: str ) -> HObject

Herror rotate_image( const Hobject Image, Hobject* ImageRotate, double Phi, const char* Interpolation )

Herror T_rotate_image( const Hobject Image, Hobject* ImageRotate, const Htuple Phi, const Htuple Interpolation )

HImage HImage::RotateImage( const HTuple& Phi, const HString& Interpolation ) const

HImage HImage::RotateImage( double Phi, const HString& Interpolation ) const

HImage HImage::RotateImage( double Phi, const char* Interpolation ) const

HImage HImage::RotateImage( double Phi, const wchar_t* Interpolation ) const (Windows only)

HImage HImage.RotateImage( HTuple phi, string interpolation )

HImage HImage.RotateImage( double phi, string interpolation )

Description🔗

rotate_imageRotateImage rotates the Imageimageimage counterclockwise by Phiphiphi degrees about its center and stores the result in the output image ImageRotateimageRotateimage_rotate. The output image has the same size as the input image. The only exception are rotations by 90 and 270 degrees where width and height will be exchanged. The domain of the input image is ignored, i.e., assumed to be the full rectangle of the image. The domain of the output image is the intersection of the transformed rectangle and the rectangle of the output image.

If Phiphiphi is a multiple of 90 degrees, this operator is much faster, especially than the general operator affine_trans_imageAffineTransImage. The effect of the parameter Interpolationinterpolationinterpolation is the same as in affine_trans_imageAffineTransImage. It is ignored for rotations by 90, 180, and 270 degrees. If it is necessary to rotate the domain, too, the operator projective_trans_imageProjectiveTransImage must be used.

Additionally, for images of type byte, int2 or uint2 the system parameter 'int_zooming'"int_zooming" selects between fast calculation in fixed point arithmetics ('int_zooming'"int_zooming" = 'true'"true") and highly accurate calculation in floating point arithmetics ('int_zooming'"int_zooming" = 'false'"false"). Except for rotations by 90, 180, or 270 degrees, fixed point calculation can lead to minor gray value deviations. Furthermore, the domain of resulting images can differ as well.

Attention🔗

The domain of the input image is ignored, i.e., assumed to be the full rectangle of the image. The domain of the output image is the intersection of the transformed rectangle and the rectangle of the output image. The angle Phiphiphi is given in degrees, not in radians. For rotations by 90, 180, and 270 degrees rotate_imageRotateImage is not parallelized internally.

rotate_imageRotateImage can be executed on OpenCL devices if the input image does not exceed the maximum size of image objects of the selected device. Due to numerical reasons, there can be slight differences in the output compared to the execution on the CPU.

Execution information🔗

Execution information
  • Supports OpenCL compute devices.

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

  • Automatically parallelized on channel level.

  • Automatically parallelized on internal data level.

Parameters🔗

Imageimageimage (input_object) (multichannel-)image(-array) → object (byte* / int2* / uint2* / real*)HObject (byte* / int2* / uint2* / real*)HImage (byte* / int2* / uint2* / real*)HObject (byte* / int2* / uint2* / real*)Hobject (byte* / int2* / uint2* / real*) *allowed for compute devices

Input image.

ImageRotateimageRotateimage_rotate (output_object) (multichannel-)image(-array) → object (byte / int2 / uint2 / real)HObject (byte / int2 / uint2 / real)HImage (byte / int2 / uint2 / real)HObject (byte / int2 / uint2 / real)Hobject * (byte / int2 / uint2 / real)

Rotated image.

Phiphiphi (input_control) angle.deg → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Rotation angle.

Default: 9090
Suggested values: 90, 180, 27090, 180, 270
Value range: 0 ≤ Phi ≤ 360
Minimum increment: 0.001
Recommended increment: 0.2

Interpolationinterpolationinterpolation (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Type of interpolation.

Default: 'constant'"constant"
List of values: 'bicubic', 'bilinear', 'constant', 'nearest_neighbor', 'weighted'"bicubic", "bilinear", "constant", "nearest_neighbor", "weighted"

Example🔗

(HDevelop)

read_image(Image,'monkey')
dev_display (Image)
rotate_image(Image,RotImage,270,'constant')
dev_display (RotImage)
(C)
read_image(&Image,"monkey")\;
disp_image(Image,WindowHandle)\;
rotate_image(Image,&RotImage,270,'constant')\;
disp_image(RotImage,WindowHandle)\;

Combinations with other operators🔗

Combinations

Alternatives

hom_mat2d_rotateHomMat2dRotate, affine_trans_imageAffineTransImage

See also

mirror_imageMirrorImage

Module🔗

Foundation