Skip to content

crop_rectangle2CropRectangle2CropRectangle2crop_rectangle2crop_rectangle2🔗

Short description🔗

crop_rectangle2CropRectangle2CropRectangle2crop_rectangle2crop_rectangle2 — Cut out one or more arbitrarily oriented rectangular image areas.

Signature🔗

crop_rectangle2( image Image, out image ImagePart, rectangle2.center.y Row, rectangle2.center.x Column, rectangle2.angle.rad Phi, rectangle2.hwidth Length1, rectangle2.hheight Length2, string AlignToAxis, string Interpolation )void CropRectangle2( const HObject& Image, HObject* ImagePart, const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Length1, const HTuple& Length2, const HTuple& AlignToAxis, const HTuple& Interpolation )static void HOperatorSet.CropRectangle2( HObject image, out HObject imagePart, HTuple row, HTuple column, HTuple phi, HTuple length1, HTuple length2, HTuple alignToAxis, HTuple interpolation )def crop_rectangle2( image: HObject, row: MaybeSequence[Union[int, float]], column: MaybeSequence[Union[int, float]], phi: MaybeSequence[Union[int, float]], length_1: MaybeSequence[Union[int, float]], length_2: MaybeSequence[Union[int, float]], align_to_axis: str, interpolation: str ) -> HObject

Herror crop_rectangle2( const Hobject Image, Hobject* ImagePart, double Row, double Column, double Phi, double Length1, double Length2, const char* AlignToAxis, const char* Interpolation )

Herror T_crop_rectangle2( const Hobject Image, Hobject* ImagePart, const Htuple Row, const Htuple Column, const Htuple Phi, const Htuple Length1, const Htuple Length2, const Htuple AlignToAxis, const Htuple Interpolation )

HImage HImage::CropRectangle2( const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Length1, const HTuple& Length2, const HString& AlignToAxis, const HString& Interpolation ) const

HImage HImage::CropRectangle2( double Row, double Column, double Phi, double Length1, double Length2, const HString& AlignToAxis, const HString& Interpolation ) const

HImage HImage::CropRectangle2( double Row, double Column, double Phi, double Length1, double Length2, const char* AlignToAxis, const char* Interpolation ) const

HImage HImage::CropRectangle2( double Row, double Column, double Phi, double Length1, double Length2, const wchar_t* AlignToAxis, const wchar_t* Interpolation ) const (Windows only)

HImage HImage.CropRectangle2( HTuple row, HTuple column, HTuple phi, HTuple length1, HTuple length2, string alignToAxis, string interpolation )

HImage HImage.CropRectangle2( double row, double column, double phi, double length1, double length2, string alignToAxis, string interpolation )

Description🔗

crop_rectangle2CropRectangle2 cuts one or more rectangular areas from each of the input images. The areas are indicated by rectangles, which are defined by the center (Rowrowrow, Columncolumncolumn), the orientation Phiphiphi and the half edge lengths Length1length1length_1 and Length2length2length_2. Phiphiphi is given in arc measure in mathematically positive direction and indicates the angle between the horizontal axis and the first edge (with length Length1length1length_1). The rectangle parameters use pixel centered, subpixel accurate coordinates, see Transformations / 2D Transformations.

The parameter AlignToAxisalignToAxisalign_to_axis determines the alignment of the output image. Possible values:

  • 'true'"true": The cropped image part is rotated such that it is aligned with the coordinate axes. For this, a suitable interpolation must be performed. A detailed description of the interpolation modes can be found in the description of affine_trans_imageAffineTransImage. The rectangle may protrude the input image. Gray values of pixels lying outside the input image are set to 0.

  • 'false'"false": The smallest surrounding rectangle of the input rectangle is cut out and the domain is set accordingly. The rectangle may exceed the input image boundaries. However, the size of the resulting cropped image part is determined by the portion of the rectangle which lies within the input image boundaries. For this method no interpolation is required. Therefore, the parameter Interpolationinterpolationinterpolation has no effect.

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.

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)

Input image(s).

ImagePartimagePartimage_part (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)

Cropped image part(s).

Rowrowrow (input_control) rectangle2.center.y(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[int, float]]Htuple (double / Hlong)

Row index of the image crop center.

Default: 300.0300.0
Suggested values: 10.0, 20.0, 50.0, 100.0, 200.0, 300.0, 400.0, 500.010.0, 20.0, 50.0, 100.0, 200.0, 300.0, 400.0, 500.0
Value range: Row (lin)
Recommended increment: 10.0

Columncolumncolumn (input_control) rectangle2.center.x(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[int, float]]Htuple (double / Hlong)

Column index of the image crop center.

Default: 200.0200.0
Suggested values: 10.0, 20.0, 50.0, 100.0, 200.0, 300.0, 400.0, 500.010.0, 20.0, 50.0, 100.0, 200.0, 300.0, 400.0, 500.0
Value range: Column (lin)
Recommended increment: 10.0

Phiphiphi (input_control) rectangle2.angle.rad(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[int, float]]Htuple (double / Hlong)

Orientation of the rectangle (arc measure).

Default: 0.00.0
Suggested values: -1.178097, -0.785398, -0.392699, 0.0, 0.392699, 0.785398, 1.178097-1.178097, -0.785398, -0.392699, 0.0, 0.392699, 0.785398, 1.178097
Value range: -1.178097 ≤ Phi ≤ 1.178097 (lin)

Length1length1length_1 (input_control) rectangle2.hwidth(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[int, float]]Htuple (double / Hlong)

First half edge length of the rectangle.

Default: 100.0100.0
Suggested values: 3.0, 5.0, 10.0, 15.0, 20.0, 50.0, 100.0, 200.0, 300.0, 500.03.0, 5.0, 10.0, 15.0, 20.0, 50.0, 100.0, 200.0, 300.0, 500.0
Value range: Length1 (lin)
Recommended increment: 10.0

Length2length2length_2 (input_control) rectangle2.hheight(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[int, float]]Htuple (double / Hlong)

Second half edge length of the rectangle.

Default: 20.020.0
Suggested values: 1.0, 2.0, 3.0, 5.0, 10.0, 15.0, 20.0, 50.0, 100.0, 200.01.0, 2.0, 3.0, 5.0, 10.0, 15.0, 20.0, 50.0, 100.0, 200.0
Value range: Length2 (lin)
Recommended increment: 10.0

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

Determines whether the cropped image part is aligned with the coordinate axes.

Default: 'true'"true"
List of values: 'false', 'true'"false", "true"

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

Interpolation method.

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

Combinations with other operators🔗

Combinations

Possible successors

disp_imageDispImage

Alternatives

crop_domainCropDomain, crop_rectangle1CropRectangle1, crop_partCropPart, change_formatChangeFormat, reduce_domainReduceDomain

See also

zoom_image_sizeZoomImageSize, zoom_image_factorZoomImageFactor

Module🔗

Foundation