VISLEVEL
(Function)
Obtain a binarization level based on the histogram result.
VISLEVEL (<mode>[, <reference area>[, <processing object>] ] )
<mode>
Specifies the method of obtaining the binarization level (0 to 2).
0: Mode method
1: Discrimination analysis method
2: P tile method
For details, refer to Part 1 5.1.1.5 "Binarization".
<reference area>
Specifies the value of the area when the system obtains the binarization level by the tiling method P (1 to 245760). If this is ignored, 1 will be the default setting.
<processing object>
Specifies the object (white and black) when the system obtains the binarization level by the tiling method P (0 or 1). If this is ignored, 1 will be the default setting.
0: Black (accumulated from brightness value 0)
1: White (accumulated from brightness value 255)
-
<reference area> and <processing object> are not used in the mode method and the discrimination analysis method.
-
You should execute VISHIST before executing this function.
-
If the designated data is incorrect, or the process result is an error, the return value will be -1.
-
For this instruction, a µVision board (option) is required.
VISCLS 0
|
|
WINDMAKE R,1,100,100,0,2
|
'Set window 1 to rectangle
|
CAMIN 1
|
'Obtain a camera image from the storage memory
|
VISWORKPLN 0
|
'Set the processing object screen to
'storage memory 0
|
VISHIST 1,100,100
|
'Execute the histogram in window 1 with the
'coordinates (100, 100) as the home position
|
WINDDISP 1
|
|
I2 = VISLEVEL(0)
|
'Obtain the binarization level using the mode
'method
|
VISLOC 10,10
|
|
IF I2 = -1 THEN VISPRINT "Error" ELSE VISPRINT "Binarization levle=";I2
|
|
I2 = VISLEVEL(1)
|
'Obtain the binarization level using the
'discrimination analysis method
|
VISLOC 10,11
|
|
IF I2 = -1 THEN VISPRINT "Error" ELSE VISPRINT "Binarization level=";I2
|
|
I2 = VISLEVEL(2,100,0)
|
'Obtain the binarization level using the P tile method
|
VISLOC 10,12
|
|
IF I2 = -1 THEN VISPRINT "Error" ELSE VISPRINT "Binarization level=";I2
|