2.2.2.1 mCrop

Brief Information

Crop a matrix to specified region of interest

Additional Information

Minimum Origin Version Required: 8.0 SR5, updated in 8.5.1

Command Line Usage

1. mCrop x:=60 y:=40 w:=200 h:=100;

2. mCrop x:=10 y:=10 w:=50 h:=50 om:=[<input>]<new name:=Cropped>;

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Left x

Input

int

1
Specify the X coordinate (in pixel) of the top-left corner of the rectangle area to be kept.
Top y

Input

int

1
Specify the Y coordinate (in pixel) of the top-left corner of the rectangle area to be kept.
Width w

Input

int

<auto>
Specify the width (in pixel) of the rectangle area to be kept.
Height h

Input

int

<auto>
Specify the height (in pixel) of the rectangle area to be kept.
Input Matrix im

Input

MatrixObject

<active>
Specify the matrix to be manipulated. The default input is the active matrix.
Output Matrix om

Output

MatrixObject

<input>
Specify the output matrix. By default, the output image is the same as the input image.

See the syntax here.

Description

This function crops an image.

If your matrix is in Image Mode, you can drag a rectangle by the Mcrop Button.png button in Tools toolbar, and right-click to crop.

You can also bring up the X-Function dialog (For example, mcrop -d;) to crop an image.

Example

  1. Select menu Data: Import from File: Image to Matrix to import the file <Origin Installation Directory>\Samples\Image Processing and Analysis\cell.jpg.
  2. Click the Mcrop Button.png on Tools toolbar, and drag a rectangle area on the image.
  3. Right-click and select Crop to crop the image.

    Crop An Image.png

    Alternatively, you can also run the following script to crop the image:
    mcrop 322 62 224 188;

Keywords:pixels, image, ROI