GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / SetROI Method
The horizontal (X) coordinate of the top left position of the ROI, in pixels.
The vertical (Y) coordinate of the top left position of the ROI, in pixels.
The required width of the ROI, in pixels.
The required height of the ROI, in pixels.
Example





In This Topic
SetROI Method (GdPictureImaging)
In This Topic
Defines the current region of interest (ROI) for further processing with this GdPictureImaging object by specifying its coordinates and dimensions. You can use the ResetROI method to clear the previously defined region of interest.
Syntax
'Declaration
 
Public Sub SetROI( _
   ByVal Left As Integer, _
   ByVal Top As Integer, _
   ByVal Width As Integer, _
   ByVal Height As Integer _
) 
public void SetROI( 
   int Left,
   int Top,
   int Width,
   int Height
)
public procedure SetROI( 
    Left: Integer;
    Top: Integer;
    Width: Integer;
    Height: Integer
); 
public function SetROI( 
   Left : int,
   Top : int,
   Width : int,
   Height : int
);
public: void SetROI( 
   int Left,
   int Top,
   int Width,
   int Height
) 
public:
void SetROI( 
   int Left,
   int Top,
   int Width,
   int Height
) 

Parameters

Left
The horizontal (X) coordinate of the top left position of the ROI, in pixels.
Top
The vertical (Y) coordinate of the top left position of the ROI, in pixels.
Width
The required width of the ROI, in pixels.
Height
The required height of the ROI, in pixels.
Remarks
Please note, that the coordinates of the upper left corner of the processed image are set to (0, 0).

Be aware that this method does not reset the previously set error status.

This method requires the Image Documents component to run.

Example
Applies a gaussian filter to a region of interest set on an image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // LoadInMemory parameter is set to true in order to be able to update the input file.
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image_1080x720.jpg", true);
 
    // Set the blur intensity of the gaussian filter.
    int kernel = 20;
 
    // Set the region of interest.
    gdpictureImaging.SetROI(300, 200, 500, 150);
    // Applying the gaussian filter to the ROI.
    gdpictureImaging.FxGaussian(imageID, kernel);
    // Deleting the region of interest.
    gdpictureImaging.ResetROI();
    gdpictureImaging.SaveAsJPEG(imageID, "image_1080x720.jpg");
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also