SetROI
Top  Previous  Next

Description

Sets the rectangular region of interest and luminance range for the histogram and image statistics calculations.


Syntax


[VB]
objActiveUSB.SetROI X1, Y1, X2, Y2 [,L1 , L2]


[C/C++]
HRESULT SetROI(long X1, long Y1, long X2, long Y2, long L1, long L2);


Data Types
[VB]

X1, Y1, X2, Y2: Long
L1, L2: Long (optional)


Parameters
[C/C++]

X1 [in], Y1 [in]  
Pixel coordinates of the top left corner of the ROI, relative to the image origin.  
X2 [in], Y2 [in]  
Pixel coordinates of the bottom right corner of the ROI, relative to the image origin.  
L1 [in], L2 [in]  
Optional threshold values specifying the luminance range for image statistics calculations. The luminance range of interest is defined as follows:  
L1<L2   Only those pixel values greater or equal to L1 and less or equal to L2 are included into the calculations  
L2<L1   Only those pixel values less than L2 or greater than L1 are included into the calculations  
L1=L2   Only those pixel values equal to L1 are included into the calculations  


Return Values


S_OK  
Success  
E_FAIL  
Failure.  

Example

The following VB example uses a slider to adjust a luminance range for the ROI:

Private Sub
 Form_Load()

ActiveUSB1.Palette = 8
HScroll1.Min = 0
HScroll1.Max = 255
X1 = 0
Y1 = 0
X2 = ActiveUSB1.SizeX
Y2 = ActiveUSB1.SizeY
L1 = 0
L2 = 255
End Sub



Private Sub
 HScrollThreshold1_Scroll()
L1 = HScrollThreshold1.Value
LabelThreshold1.Caption = L1
ActiveUSB1.SetROI X1, Y1, X2, Y2, L1, L2
End Sub



Remarks


If all four parameters are zero, the ROI will be reset to the maximum image area.