Set the parameter of region of multiple processing units at once

Overview

This sample sets the parameter of region of multiple processing units at once.

Specification of this example


Behavior
This sample sets the parameter of region of [Gravity and Area] and [Color Data] at once.

Screenshot


How to try this example
1.Click the link below, then the folder containing zip file automatically opens.
refFile

2.Right-click and hold on the zip file, and drop it on working window of FJ system. The images and scene data in zip file are loaded on the program automatically.

3.Re-measure the image. Then System automatically sets the parameter of region of [Gravity and Area] and [Color Data] at once.
The setting of region setting repeats following data.
Upper left position : ( 60, 110) → ( 40, 260) → ( 60, 110) → ...
Lower right position : (270, 230) → (170, 410) → (270, 230) → ...

How to implement

Scene data
Unit No.
Processing Item
0.
Camera Image Input
1.
Macro
2.
Gravity and Area
3.
Color Data
The Macro Program below segment is to be set in '1.Macro'.
Macro Program
*MCRINIT
    Dim X1&(1)
    Dim X2&(1)
    Dim Y1&(1)
    Dim Y2&(1)

    X1&(0) = 60         '(1)
    Y1&(0) = 110
    X2&(0) = 270
    Y2&(0) = 230

    X1&(1) = 40
    Y1&(1) = 260
    X2&(1) = 170
    Y2&(1) = 410

    INDEX& = 0
    FIGURENO& = 0
    UNITNO1& = 2
    UNITNO2& = 3
Return

*MEASUREPROC

    Dim FIGDATA&(30)

    GetUnitFigure UNITNO1&, FIGURENO&, FIGDATA&()  '(2)

    If INDEX& = 0 Then
        INDEX& = 1
    Else
        INDEX& = 0
    EndIf

    FIGDATA&(2) = X1&(INDEX&)         '(3)
    FIGDATA&(3) = Y1&(INDEX&)
    FIGDATA&(4) = X2&(INDEX&)
    FIGDATA&(5) = Y2&(INDEX&)

    SetUnitFigure UNITNO1&, FIGURENO&, FIGDATA&()  '(4)
    SetUnitFigure UNITNO2&, FIGURENO&, FIGDATA&()

Return

The macro program is in refthis link.
Explanation
(1)Initialize parameters(ex.coordinate of regions) when initialize measurement.
(2)Get the region of [Gravity and Area].
(3)Set the coordinate of the region.
(4)Set the regions of [Gravity and Area] and [Color Data].