Draw a figure on Image Window

Overview

Draw a figure on Image Window.

Specification of this example


Behavior
Draw a cross cursor at the reference point position of [Search] unit on Image Window.

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 a cross cursor is displayed on Image Window.

How to implement

Scene data
Unit No.
Processing Item
0.
Camera Image Input
1.
Search
2.
Macro
The Macro Program below segment is to be set in '2.Macro'.
Macro Program
*MEASUREPROC
Return

*MEASUREDISPG
    MeasureDispG 1,0                              '(1)

    MYUNIT& = UnitNo                              '(2)
    SX& = UnitData(MYUNIT& - 1,"SX")
    SY& = UnitData(MYUNIT& - 1,"SY")

    SetDrawStyle PS_SOLID, 3, JUDGE_NG            '(3)
    DrawLine SX&, SY& - 10, SX&, SY& + 10, 0
    DrawLine SX& - 10, SY&, SX& + 10, SY&, 0
Return

The macro program is in refthis link.
Explanation
(1)Set unit no. (No.1 [Search]) which to be displayed by [MeasureDispG] command.
(2)Get reference position X,Y of [Search] unit via external reference data.
(3)Draw a cross cursor.