Skip to content

Commit 1fa408a

Browse files
committed
* Code / docu updates
* Added setup to translate aligned image
1 parent 904954f commit 1fa408a

9 files changed

Lines changed: 496 additions & 226 deletions

File tree

CSK_Module_MultiImageEdgeMatcher/pages/pages/CSK_Module_MultiImageEdgeMatcher/CSK_Module_MultiImageEdgeMatcher.html

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,25 @@
4242
</davinci-drop-down>
4343
</layout-column>
4444
</layout-row>
45+
<layout-row id="RowLayout18"
46+
style="justify-content: space-between; align-items: center">
47+
<layout-column id="ColumnLayout26" style="align-items: stretch">
48+
<davinci-value-display id="VD_ShowImage" value="Show image:">
49+
</davinci-value-display>
50+
</layout-column>
51+
<layout-column id="ColumnLayout27" style="align-items: flex-end">
52+
<davinci-toggle-switch id="TS_ShowImage">
53+
<crown-edpws-binding property="checked"
54+
name="CSK_MultiImageEdgeMatcher/OnNewStatusShowImage"
55+
update-on-resume>
56+
</crown-edpws-binding>
57+
<crown-binding event="change"
58+
name="CSK_MultiImageEdgeMatcher/setShowImage"
59+
path="param/args/status" auto-commit>
60+
</crown-binding>
61+
</davinci-toggle-switch>
62+
</layout-column>
63+
</layout-row>
4564
<layout-row id="RowLayout16" style="align-items: center">
4665
<layout-column id="ColumnLayout20" style="align-items: stretch">
4766
<davinci-value-display id="VD_RegisteredEvent"
@@ -62,25 +81,6 @@
6281
</davinci-text-field>
6382
</layout-column>
6483
</layout-row>
65-
<layout-row id="RowLayout18"
66-
style="justify-content: space-between; align-items: center">
67-
<layout-column id="ColumnLayout26" style="align-items: stretch">
68-
<davinci-value-display id="VD_ShowImage" value="Show image:">
69-
</davinci-value-display>
70-
</layout-column>
71-
<layout-column id="ColumnLayout27" style="align-items: flex-end">
72-
<davinci-toggle-switch id="TS_ShowImage">
73-
<crown-edpws-binding property="checked"
74-
name="CSK_MultiImageEdgeMatcher/OnNewStatusShowImage"
75-
update-on-resume>
76-
</crown-edpws-binding>
77-
<crown-binding event="change"
78-
name="CSK_MultiImageEdgeMatcher/setShowImage"
79-
path="param/args/status" auto-commit>
80-
</crown-binding>
81-
</davinci-toggle-switch>
82-
</layout-column>
83-
</layout-row>
8484
<davinci-button id="Button1" type="primary" icon-position="append"
8585
toggle>
8686
<span>Teach Mode</span>
@@ -172,6 +172,39 @@
172172
</davinci-numeric-field>
173173
</layout-column>
174174
</layout-row>
175+
<davinci-value-display id="VD_ResultTranslation"
176+
value="Result translation in X / Y directin [px]:">
177+
</davinci-value-display>
178+
<layout-row id="RowLayout19">
179+
<layout-column id="ColumnLayout28" style="align-items: stretch">
180+
<davinci-numeric-field id="NF_ResultTransX" type="outline" min="0"
181+
max="9999" ticks="1" group-separator="," decimal-separator="."
182+
format-pattern="0">
183+
<crown-edpws-binding property="value"
184+
name="CSK_MultiImageEdgeMatcher/OnNewStatusResultTranslateX"
185+
update-on-resume>
186+
</crown-edpws-binding>
187+
<crown-binding event="change"
188+
name="CSK_MultiImageEdgeMatcher/setResultTransX"
189+
path="param/args/value" auto-commit>
190+
</crown-binding>
191+
</davinci-numeric-field>
192+
</layout-column>
193+
<layout-column id="ColumnLayout29" style="align-items: stretch">
194+
<davinci-numeric-field id="NF_ResultTransY" type="outline" min="0"
195+
max="9999" ticks="1" group-separator="," decimal-separator="."
196+
format-pattern="0">
197+
<crown-edpws-binding property="value"
198+
name="CSK_MultiImageEdgeMatcher/OnNewStatusResultTranslateY"
199+
update-on-resume>
200+
</crown-edpws-binding>
201+
<crown-binding event="change"
202+
name="CSK_MultiImageEdgeMatcher/setResultTransY"
203+
path="param/args/value" auto-commit>
204+
</crown-binding>
205+
</davinci-numeric-field>
206+
</layout-column>
207+
</layout-row>
175208
<davinci-value-display id="VD_Results" label="Results">
176209
</davinci-value-display>
177210
<layout-row id="RowLayout7">

CSK_Module_MultiImageEdgeMatcher/project.mf.xml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ This module provides a UI for all relevant features. +
1111
{empty} +
1212
Typically to configure this module to work with other modules you should do this: +
1313
{empty} +
14-
1) If multiple instances are needed, these can be added via addInstance() (not needed if you only use 1 single instace). +
14+
1) If multiple instances are needed, these can be added via 'addInstance' (not needed if you only use 1 single instace). +
1515
2) Select the instance you want to configur via setInstance(). +
1616
3) Set the event providing the images to be processed e.g. via setRegisterEvent('CSK_ImagePlayer.OnNewImage'). +
1717
4) Optionally edit EdgeMatcher parameters via 'setEdgeThreshold', 'setMaximumMatches', 'setDownsampleFactor'. +
1818
5) Press the "Teach Mode" button within the UI. It will provide a ROI editor to select a an object and show its teached edges. Press the button again to confirm the teached structure.+
1919
6) Define the minimum valid score via 'setMinScore'. +
20-
7) The module will align the image in relation to the first found object. Other modules can register on the 'CSK_MultiImageEdgeMatcher.OnNewAlignedImage[NUM]' event to receive the aligned image for further processing or on 'OnNewStatusFoundMatchesNUM' / 'OnNewStatusMatchScoreResultNUM' to receive the processing result values. +
20+
7) The module will align the image in relation to the first found object. Other modules can register on the 'CSK_MultiImageEdgeMatcher.OnNewAlignedImage[NUM]' event to receive the aligned image for further processing, on the 'CSK_MultiImageEdgeMatcher.OnNewTransformation[NUM]' event to receive the transformation itself or on 'OnNewStatusFoundMatchesNUM' / 'OnNewStatusMatchScoreResultNUM' to receive the processing result values. +
2121
{empty} +</desc>
2222
<serves>
2323
<event name="OnNewStatusLoadParameterOnReboot">
@@ -68,15 +68,15 @@ Typically to configure this module to work with other modules you should do this
6868
</event>
6969
<event name="OnNewValueUpdateNUM">
7070
<desc>Example of dynamically created event to sync paramters between instance threads and Controller part of module. +
71-
NUM will be replaced by the number of instance (e.g. "OnNewResult1"). +</desc>
71+
NUM will be replaced by the number of instance (e.g. "OnNewValueUpdate1"). +</desc>
7272
<param desc="Instance new value is coming from." multiplicity="1" name="instance" type="int"/>
7373
<param desc="Name of the paramter to update/sync." multiplicity="1" name="parameter" type="string"/>
7474
<param desc="Value to update." multiplicity="1" name="value" type="auto"/>
7575
<param desc="Optionally if internal parameter should be used for internal objects." multiplicity="?" name="selectedObject" type="int"/>
7676
</event>
7777
<event name="OnNewValueToForwardNUM">
7878
<desc>Example of dynamically created event to forward data from instance thread to Controller part of module, e.g. to forward values to UI. +
79-
NUM will be replaced by the number of instance (e.g. "OnNewResult1"). +</desc>
79+
NUM will be replaced by the number of instance (e.g. "OnNewValueToForward1"). +</desc>
8080
<param desc="Eventname to use to forward value." multiplicity="1" name="eventname" type="string"/>
8181
<param desc="Value to forward." multiplicity="1" name="value" type="auto"/>
8282
</event>
@@ -139,6 +139,20 @@ NUM will be replaced by the number of instance (e.g. "OnNewStatusFoundMatches1")
139139
INFO: Other modules can check via "Script.isServedAsEvent" if event of sepecific instance exists.</desc>
140140
<param desc="Amount of found matches." multiplicity="1" name="amount" type="int"/>
141141
</event>
142+
<event name="OnNewTransformationNUM">
143+
<desc>Example of dynamically created event to provide transformation data to be used for post processing. +
144+
NUM will be replaced by the number of instance (e.g. "OnNewTransformation1"). +
145+
INFO: Other modules can check via "Script.isServedAsEvent" if event of sepecific instance exists.</desc>
146+
<param alias="Transform" desc="Transformation" multiplicity="1" name="transform" type="object"/>
147+
</event>
148+
<event name="OnNewStatusResultTranslateX">
149+
<desc>Notify pixel to transform result in x direction.</desc>
150+
<param desc="Pixel in x direction." multiplicity="1" name="value" type="int"/>
151+
</event>
152+
<event name="OnNewStatusResultTranslateY">
153+
<desc>Notify pixel to transform result in y direction.</desc>
154+
<param desc="Pixel in x direction." multiplicity="1" name="value" type="int"/>
155+
</event>
142156
<function name="setParameterName">
143157
<desc>Function to set the name of the parameters if saved/loaded via the CSK_PersistentData module.</desc>
144158
<param desc="Name of the parameter" multiplicity="1" name="name" type="string"/>
@@ -167,8 +181,8 @@ INFO: Other modules can check via "Script.isServedAsEvent" if event of sepecific
167181
</function>
168182
<function name="setRegisterEvent">
169183
<desc>Configure event that this module should listen to. If this one is notified, it will be linked to internal processing function. +
170-
(Will be set to currently active instance, see "setSelectedObject")</desc>
171-
<param desc="(external) Event name to listen to." multiplicity="1" name="event" type="string"/>
184+
(Will be set to currently active instance, see 'setSelectedObject')</desc>
185+
<param desc="Event name to listen to." multiplicity="1" name="event" type="string"/>
172186
</function>
173187
<function name="processInstanceNUM">
174188
<desc>Example of dynamically served function to process internally coded function. +
@@ -212,6 +226,14 @@ Setting this parameter will invalidate any previous teach call!</desc>
212226
<desc>Function to select if image should be shown on UI.</desc>
213227
<param desc="Status" multiplicity="1" name="status" type="bool"/>
214228
</function>
229+
<function name="setResultTransX">
230+
<desc>Function to set image translation in x direction added to found object position.</desc>
231+
<param desc="Pixel in x direction." multiplicity="1" name="value" type="int"/>
232+
</function>
233+
<function name="setResultTransY">
234+
<desc>Function to set image translation in y direction added to found object position.</desc>
235+
<param desc="Pixel in y direction." multiplicity="1" name="value" type="int"/>
236+
</function>
215237
</serves>
216238
</crown>
217239
<meta key="author">SICK AG</meta>

CSK_Module_MultiImageEdgeMatcher/scripts/CSK_Module_MultiImageEdgeMatcher.lua

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -60,30 +60,6 @@ multiImageEdgeMatcherController.setMultiImageEdgeMatcher_Instances_Handle(multiI
6060
--**********************Start Function Scope *******************************
6161
--**************************************************************************
6262

63-
--[[
64-
--- Function to show how this module could be used
65-
local function startProcessing()
66-
67-
CSK_MultiImageEdgeMatcher.setSelectedInstance(1) --> select instance of module
68-
CSK_MultiImageEdgeMatcher.doSomething() --> preparation
69-
70-
-- Option A --> prepare an event to trigger processing via this one
71-
--Script.serveEvent("CSK_MultiImageEdgeMatcher.OnNewTestEvent", "MultiImageEdgeMatcher_OnNewTestEvent") --> Create event to listen to and process forwarded object
72-
--CSK_MultiImageEdgeMatcher.setRegisterEvent('CSK_MultiImageEdgeMatcher.OnNewTestEvent') --> Register processing to the event
73-
74-
--Script.notifyEvent('OnNewTestEvent', data)
75-
76-
-- Option B --> trigger processing via function call
77-
local result = CSK_MultiImageEdgeMatcher.processSomething(data)
78-
79-
end
80-
end
81-
82-
-- Call processing function after persistent data was loaded
83-
--Script.register("CSK_MultiImageEdgeMatcher.OnDataLoadedOnReboot", startProcessing)
84-
]]
85-
86-
--OR
8763

8864
--- Function to react on startup event of the app
8965
local function main()
@@ -95,11 +71,10 @@ local function main()
9571
-- event CSK_PersistentData.OnInitialDataLoaded
9672
-- (see internal variable _G.multiImageEdgeMatcher_Model.parameterLoadOnReboot)
9773
-- If so, the app will trigger the "OnDataLoadedOnReboot" event if ready after loading parameters
98-
--
99-
-- Can be used e.g. like this
74+
-- Check UI for setup
10075
----------------------------------------------------------------------------------------
10176

102-
CSK_MultiImageEdgeMatcher.setSelectedInstance(1)
77+
CSK_MultiImageEdgeMatcher.setSelectedInstance(1) --> select instance of module
10378
CSK_MultiImageEdgeMatcher.pageCalled() -- Update UI
10479

10580
end

0 commit comments

Comments
 (0)