SHMODEL (Statement)


Search for a model.


SHMODEL <window number>, <coordinate X>, <coordinate Y>, <model number>, <correspondence degree>[, <mode>[, <number>[, <start angle>[, <end angle>]]]]


<window number>
Designates the window number (0 to 511).
<coordinate X>
Designates the X coordinate (0 to 511).
<coordinate Y>
Designates the Y coordinate (0 to 479).
<model number>
Designates the model number to search for (0 to 99).
<correspondence degree>
Designates the correspondence degree of the model to search for (0 to 100).
<mode>
Designates the mode when searching is executed.
0: Search in pixel units.
1: Search in sub-pixel units.
If these are ignored, 0 is set as the default.
<number>
Designates the number of models to search for at a time (1 to 49). If this is ignored, 1 is set.
<start angle>
Designates an angular range (start angle) for an object to be searched (-360 to 360). 0 is assumed as the default. [V1.4 or later]
<end angle>
Designates an angular range (end angle) for an object to be searched (-360 to 360). 0 is assumed as the default. [V1.4 or later]
  • Register the model to search for with SHDEFMODEL.
  • When you set two or more numbers and the system cannot find a designated number, an error occurs.
  • A search requires time, and if searching is not finished within a limited time, a timeout error occurs. You can set this on your personal computer. The initial setting is 2 seconds.
  • If the correspondence degree is set to high, searching cannot be performed; therefore, decrease the correspondence degree.
  • Designate the process range with a window.
  • If the position of the designated window is not on the screen, an execution error will result.
  • The shape of the window available to designate is a rectangle with 0 degrees. If you designate any shape other than this, an error occurs.
  • The processing object is the screen designated with VISWORKPLN.
  • When this command is executed, the process screen 3 (VISWORKPLN 3) is used as a work area and data on the process screen 3 are not guaranteed. Also, you cannot use the process screen 3 for processing.
  • You can obtain data with the processing result obtaining function after executing an instruction.
    VISSTATUS (n)
    n
    Item
    0
    Execution result
    0 = Normal
    -1 = Model Unregistered
    -2 = Failure
    -3 = Timeout
    1
    Number
    2
    Execution time

    VISGETNUM (a, b)
    b
    a = 0~49
    0
    Number
    1
    X Coordinate Value
    2
    Y Coordinate Value
    3
    Correspondence Degree
    4
    Angle [V1.4 or later]
    5
    X Coordinate Value for Origin [V1.4 or later]
    6
    Y Coordinate Value for Origin [V1.4 or later]
    7
    Angle from Angular Origin [V1.4 or later]
    8
    unknown
    9
    unknown

  • µVision board (optional) is required for this command.
  • If the searching mode size and the widow size coincide, the correspondence degree only at that position is calculated.
  • An angles measurement is executed when you set both [Start Angle] and [End Angle] to 0.
  • An angle measurement is executed as you set as [Start Angle] = 0 and [End Angle] = 360, if you set both [Start Angle] and [End Angle] to the same value other than 0.



VISSCREEN 1,0,1
'Instantaneously draws on drawing screen 0.
VISCLS 0
VISPLNOUT 0
WINDMAKE R,1,512,480,0,2
'Sets window 1 to rectangle.
CAMIN 1
'Obtains a camera image from the storage memory.
VISWORKPLN 0
'Designates an object to storage memory 0.
SHMODEL 1,0,0,1,80
'Searches for model 1 and the part whose correspondence
'degree is 80% on the screen.
I1 = VISSTATUS(0)
VISLOC 10,10
VISDEFCHAR 1,1,3
VISPRINT I1
IF I1 = 0 THEN
VISPRINT VISGETNUM(0,1),VISGETNUM(0,2)
VISCROSS VISPOSX(0),VISPOSY(0)
END IF


Top