Skip to content

Commit 904954f

Browse files
committed
# Push of first features
1 parent d5cf550 commit 904954f

10 files changed

Lines changed: 1845 additions & 388 deletions

File tree

CSK_Module_MultiImageEdgeMatcher/pages/pages/CSK_Module_MultiImageEdgeMatcher/CSK_Module_MultiImageEdgeMatcher.html

Lines changed: 311 additions & 106 deletions
Large diffs are not rendered by default.

CSK_Module_MultiImageEdgeMatcher/project.mf.xml

Lines changed: 100 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@
66
</crown>
77
<crown name="CSK_MultiImageEdgeMatcher">
88
<trait>released</trait>
9-
<desc>Please fill in information regarding: What is the idea of this module and its features? +
10-
How to use this module in general.... like: +
11-
{empty} +
12-
Typically the features of this module are used like this (check also main script of this module): +
13-
{empty} +
14-
**1) Setup** +
15-
ToDo +
16-
{empty} +
17-
**2) Something else....** +
18-
</desc>
9+
<desc>Module to provide EdgeMatcher functionality. Multiple instances can be created and will run in multiple threads on the device. +
10+
This module provides a UI for all relevant features. +
11+
{empty} +
12+
Typically to configure this module to work with other modules you should do this: +
13+
{empty} +
14+
1) If multiple instances are needed, these can be added via addInstance() (not needed if you only use 1 single instace). +
15+
2) Select the instance you want to configur via setInstance(). +
16+
3) Set the event providing the images to be processed e.g. via setRegisterEvent('CSK_ImagePlayer.OnNewImage'). +
17+
4) Optionally edit EdgeMatcher parameters via 'setEdgeThreshold', 'setMaximumMatches', 'setDownsampleFactor'. +
18+
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.+
19+
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. +
21+
{empty} +</desc>
1922
<serves>
2023
<event name="OnNewStatusLoadParameterOnReboot">
2124
<desc>Notify status if parameters should be loaded on app/device boot up.</desc>
@@ -43,12 +46,6 @@ ToDo +
4346
<event name="OnDataLoadedOnReboot">
4447
<desc>Event to call if module tried to load parameters and should be ready.</desc>
4548
</event>
46-
<event name="OnNewResultNUM">
47-
<desc>Example of dynamically created event to provide result of instance. +
48-
NUM will be replaced by the number of instance (e.g. "OnNewResult1"). +
49-
INFO: Other modules can check via "Script.isServedAsEvent" if event of sepecific instance exists.</desc>
50-
<param desc="Result" multiplicity="1" name="result" type="bool"/>
51-
</event>
5249
<event name="OnNewParameterName">
5350
<desc>Notify name of persistent data parameter.</desc>
5451
<param desc="Parameter name" multiplicity="1" name="name" type="string"/>
@@ -83,9 +80,64 @@ NUM will be replaced by the number of instance (e.g. "OnNewResult1"). +</desc>
8380
<param desc="Eventname to use to forward value." multiplicity="1" name="eventname" type="string"/>
8481
<param desc="Value to forward." multiplicity="1" name="value" type="auto"/>
8582
</event>
86-
<event name="OnNewResult">
87-
<desc>Generic event to notify results. E.g. to forward results from single instances.</desc>
88-
<param desc="Result" multiplicity="1" name="result" type="bool"/>
83+
<event name="OnNewViewerID">
84+
<desc>Notify viewerID for viewer in UI for currently selected instance.</desc>
85+
<param desc="ViewerID" multiplicity="1" name="id" type="string"/>
86+
</event>
87+
<event name="OnNewStatusRegisteredEvent">
88+
<desc>Notify event instance is registered to receive new image to process.</desc>
89+
<param desc="Name of event." multiplicity="1" name="eventname" type="string"/>
90+
</event>
91+
<event name="OnROIEditorActive">
92+
<desc>Notify if ROI editor is currently active in UI.</desc>
93+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
94+
</event>
95+
<event name="OnNewStatusShowImage">
96+
<desc>Notify if image should be showed in UI.</desc>
97+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
98+
</event>
99+
<event name="OnNewStatusEdgeThreshold">
100+
<desc>Notify currently used edge threshold.</desc>
101+
<param desc="Edge threshold." multiplicity="1" name="threshold" type="int"/>
102+
</event>
103+
<event name="OnNewStatusMinimalScore">
104+
<desc>Notify currently minimal valid match score.</desc>
105+
<param desc="Minimal valid match score." multiplicity="1" name="score" type="float"/>
106+
</event>
107+
<event name="OnNewStatusDownsampleFactor">
108+
<desc>Notify currently used downsample factor of edge matcher.</desc>
109+
<param desc="Downsample factor" multiplicity="1" name="factor" type="int"/>
110+
</event>
111+
<event name="OnNewStatusMaxMatches">
112+
<desc>Notify maximum amount of matches to find.</desc>
113+
<param desc="Maximum amount of matches." multiplicity="1" name="max" type="int"/>
114+
</event>
115+
<event name="OnNewAlignedImageNUM">
116+
<desc>Example of dynamically created event to provide aligned image to be used for post processing. +
117+
NUM will be replaced by the number of instance (e.g. "OnNewAlignedImage1"). +
118+
INFO: Other modules can check via "Script.isServedAsEvent" if event of sepecific instance exists.</desc>
119+
<param alias="Image" desc="Aligned image" multiplicity="1" name="image" type="object"/>
120+
</event>
121+
<event name="OnNewStatusMatchScoreResultNUM">
122+
<desc>Notify score of match.
123+
Example of dynamically created event to provide score of match. +
124+
NUM will be replaced by the number of instance (e.g. "OnNewStatusMatchScoreResult1"). +
125+
INFO: Other modules can check via "Script.isServedAsEvent" if event of sepecific instance exists.</desc>
126+
<param desc="Score of match." multiplicity="1" name="score" type="float"/>
127+
</event>
128+
<event name="OnNewStatusMatchScoreResult">
129+
<desc>Notify score of found match of currently selected EdgeMatcher instance.</desc>
130+
<param desc="Score of match." multiplicity="1" name="score" type="string"/>
131+
</event>
132+
<event name="OnNewStatusFoundMatches">
133+
<desc>Notify amount of found matches of currently selected EdgeMatcher instance.</desc>
134+
<param desc="Amount of found matches." multiplicity="1" name="amount" type="string"/>
135+
</event>
136+
<event name="OnNewStatusFoundMatchesNUM">
137+
<desc>Example of dynamically created event to provide result of found matches. +
138+
NUM will be replaced by the number of instance (e.g. "OnNewStatusFoundMatches1"). +
139+
INFO: Other modules can check via "Script.isServedAsEvent" if event of sepecific instance exists.</desc>
140+
<param desc="Amount of found matches." multiplicity="1" name="amount" type="int"/>
89141
</event>
90142
<function name="setParameterName">
91143
<desc>Function to set the name of the parameters if saved/loaded via the CSK_PersistentData module.</desc>
@@ -123,7 +175,7 @@ NUM will be replaced by the number of instance (e.g. "OnNewResult1"). +</desc>
123175
NUM will be replaced by the number of instance (e.g. "processInstance1"). +
124176
INFO: Other modules can check via "Script.isServedAsFunction" if function of sepecific instance exists. +
125177
Needs then to be called via "Script.callFunction".</desc>
126-
<param alias="Alias" desc="Transferred object (optional)" multiplicity="?" name="object" type="object"/>
178+
<param alias="Image" desc="Transferred object (optional)" multiplicity="1" name="image" type="object"/>
127179
<return desc="Processing result (optional)." multiplicity="?" name="result" type="bool"/>
128180
</function>
129181
<function name="addInstance">
@@ -133,6 +185,33 @@ Needs then to be called via "Script.callFunction".</desc>
133185
<desc>Function to reset instances to one single instance. +
134186
IMPORTANT: As instances start their own threads, the module needs to be restarted if new instances are needed... (see AppEngine docu for "Script.startScript").</desc>
135187
</function>
188+
<function name="setTeachMode">
189+
<desc>Set status of teach mode for edge matcher. +
190+
If TRUE, the viewer in the UI will install an editor for the ROI. +
191+
If FALSE it will update the masks accordingly.</desc>
192+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
193+
</function>
194+
<function name="setEdgeThreshold">
195+
<desc>Function to set edge threshold.</desc>
196+
<param desc="Edge threshold" multiplicity="1" name="threshold" type="int"/>
197+
</function>
198+
<function name="setMinimumValidScore">
199+
<desc>Function to set minimal valid match score.</desc>
200+
<param desc="Minimal valid match score." multiplicity="1" name="minScore" type="float"/>
201+
</function>
202+
<function name="setDownsampleFactor">
203+
<desc>Function to set downsample factor of edge matcher. +
204+
Setting this parameter will invalidate any previous teach call!</desc>
205+
<param desc="Downsample factor." multiplicity="1" name="factor" type="int"/>
206+
</function>
207+
<function name="setMaximumMatches">
208+
<desc>Function to set maximum amount of matches to find.</desc>
209+
<param desc="Maximum amount of matches." multiplicity="1" name="max" type="int"/>
210+
</function>
211+
<function name="setShowImage">
212+
<desc>Function to select if image should be shown on UI.</desc>
213+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
214+
</function>
136215
</serves>
137216
</crown>
138217
<meta key="author">SICK AG</meta>
@@ -141,7 +220,7 @@ IMPORTANT: As instances start their own threads, the module needs to be restarte
141220
<meta key="copy-protected">false</meta>
142221
<meta key="read-protected">false</meta>
143222
<meta key="crown2-flow-engine">false</meta>
144-
<meta key="LuaLoadAllEngineAPI">true</meta>
223+
<meta key="LuaLoadAllEngineAPI">false</meta>
145224
<entry default="CSK_Module_MultiImageEdgeMatcher.lua" path="scripts"/>
146225
</application>
147226
</manifest>

CSK_Module_MultiImageEdgeMatcher/scripts/CSK_Module_MultiImageEdgeMatcher.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
-- If app property "LuaLoadAllEngineAPI" is FALSE, use this to load and check for required APIs
3232
-- This can improve performance of garbage collection
3333

34-
-- _G.availableAPIs = require('ImageProcessing/MultiImageEdgeMatcher/helper/checkAPIs') -- can be used to adjust function scope of the module related on available APIs of the device
34+
_G.availableAPIs = require('ImageProcessing/MultiImageEdgeMatcher/helper/checkAPIs') -- can be used to adjust function scope of the module related on available APIs of the device
3535
-----------------------------------------------------------
3636
-- Logger
3737
_G.logger = Log.SharedLogger.create('ModuleLogger')
@@ -99,7 +99,7 @@ local function main()
9999
-- Can be used e.g. like this
100100
----------------------------------------------------------------------------------------
101101

102-
--startProcessing() --> see above
102+
CSK_MultiImageEdgeMatcher.setSelectedInstance(1)
103103
CSK_MultiImageEdgeMatcher.pageCalled() -- Update UI
104104

105105
end

0 commit comments

Comments
 (0)