Skip to content

Commit 6e0fb9d

Browse files
Version 1.0.0 (#1)
- Initial version --------- Co-authored-by: tarnamaSICKAG <126787732+tarnamaSICKAG@users.noreply.github.com>
1 parent 8c7e912 commit 6e0fb9d

13 files changed

Lines changed: 2915 additions & 450 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4-
## Release 0.1.0
5-
- Initial commit
6-
7-
### New features
8-
- ...
9-
10-
### Improvements
11-
- ...
12-
13-
### Bugfix
14-
- ...
4+
## Release 1.0.0
5+
- Initial commit

CSK_Module_MultiImageFilter/pages/pages/CSK_Module_MultiImageFilter/CSK_Module_MultiImageFilter.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,10 @@
55
margin: 6px;
66
}
77

8+
.myViewer_CSK_Module_MultiImageFilter > div > div {
9+
max-height: 800px;
10+
min-height: 800px;
11+
}
12+
813
.myCustomCssClass_CSK_Module_MultiImageFilter {
914
}

CSK_Module_MultiImageFilter/pages/pages/CSK_Module_MultiImageFilter/CSK_Module_MultiImageFilter.html

Lines changed: 488 additions & 106 deletions
Large diffs are not rendered by default.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
export function convertToList(value) {
22
return JSON.parse(value)
3+
}
4+
5+
export function changeID(id) {
6+
const viewerElement = document.getElementById('Viewer2D1');
7+
viewerElement.setAttribute('viewer-id', id);
8+
viewerElement.triggerResume();
9+
return id;
310
}

CSK_Module_MultiImageFilter/project.mf.xml

Lines changed: 161 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,31 @@
66
</crown>
77
<crown name="CSK_MultiImageFilter">
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 image filter processing 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 image filter type via 'setFilterType' and optionally set according filter values if necessary. +
17+
4) Set the event providing the images to be processed e.g. via setRegisterEvent('CSK_ImagePlayer.OnNewImage'). +
18+
5) Other modules can register on the 'CSK_MultiImageFilter.OnNewImage[NUM]' event to receive the filtred image for further processing. +
19+
{empty} +
20+
INFO: It is possible to combine multiple filters / instances by adding instances and to register to the related preprocessed image like described in step 5). +</desc>
21+
<enum name="ImageFilter" trait="released">
22+
<desc>Available image filter.</desc>
23+
<item desc="Convert RGB image to gray image." name="Gray">Gray</item>
24+
<item desc="Canny filter." name="Canny">Canny</item>
25+
<item desc="Blur filter." name="Blur">Blur</item>
26+
<item desc="Crop image." name="Crop">Crop</item>
27+
<item desc="Transform image." name="Transform">Transform</item>
28+
</enum>
29+
<enum name="TransformationSource" trait="released">
30+
<desc>Source for transformation data.</desc>
31+
<item desc="Manually set config to transform image." name="MANUAL">MANUAL</item>
32+
<item desc="Receive config to transform image from external source via event." name="EXTERNAL">EXTERNAL</item>
33+
</enum>
1934
<serves>
2035
<event name="OnNewStatusLoadParameterOnReboot">
2136
<desc>Notify status if parameters should be loaded on app/device boot up.</desc>
@@ -34,7 +49,7 @@ ToDo +
3449
<param desc="Number of the instance to receive the parameter." multiplicity="1" name="objectNo" type="int"/>
3550
<param desc="Name of the parameter." multiplicity="1" name="parameter" type="string"/>
3651
<param desc="Value of the parameter." multiplicity="1" name="value" type="auto"/>
37-
<param desc="If parameter is for specifici internal used object, its number." multiplicity="?" name="internalObjectNo" type="int"/>
52+
<param desc="If parameter is for specific internal used object, its number." multiplicity="?" name="internalObjectNo" type="int"/>
3853
</event>
3954
<event name="OnNewSelectedInstance">
4055
<desc>Notify if new instance is selected.</desc>
@@ -43,11 +58,11 @@ ToDo +
4358
<event name="OnDataLoadedOnReboot">
4459
<desc>Event to call if module tried to load parameters and should be ready.</desc>
4560
</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"). +
61+
<event name="OnNewImageNUM">
62+
<desc>Example of dynamically created event to provide result image of instance. +
63+
NUM will be replaced by the number of instance (e.g. "OnNewImage1"). +
4964
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"/>
65+
<param alias="Image" desc="Result image." multiplicity="?" name="resultImage" type="object"/>
5166
</event>
5267
<event name="OnNewParameterName">
5368
<desc>Notify name of persistent data parameter.</desc>
@@ -87,6 +102,74 @@ NUM will be replaced by the number of instance (e.g. "OnNewResult1"). +</desc>
87102
<desc>Generic event to notify results. E.g. to forward results from single instances.</desc>
88103
<param desc="Result" multiplicity="1" name="result" type="bool"/>
89104
</event>
105+
<event name="OnNewStatusImageFilterType">
106+
<desc>Notify selected image filter type.</desc>
107+
<param desc="Filter type." multiplicity="1" name="filterType" type="string"/>
108+
</event>
109+
<event name="OnNewViewerID">
110+
<desc>Notify currently used viewerID (e.g. to show correct viewer in UI).</desc>
111+
<param desc="viewerID" multiplicity="1" name="viewerID" type="string"/>
112+
</event>
113+
<event name="OnNewStatusRegisteredEvent">
114+
<desc>Notify event instance is registered to receive new image to process.</desc>
115+
<param desc="Name of event." multiplicity="1" name="eventname" type="string"/>
116+
</event>
117+
<event name="OnNewStatusShowImage">
118+
<desc>Notify if image should be showed in UI.</desc>
119+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
120+
</event>
121+
<event name="OnNewStatusBlurKernelSizePix">
122+
<desc>Notify kernel size of blur filter.</desc>
123+
<param desc="Size of the kernel." multiplicity="1" name="size" type="int"/>
124+
</event>
125+
<event name="OnNewStatusCannyThresholds">
126+
<desc>Notify threshold values of canny filter.</desc>
127+
<param desc="Threshold values." multiplicity="+" name="threshold" type="float"/>
128+
</event>
129+
<event name="OnNewStatusCropPosX">
130+
<desc>Notify x position to crop image.</desc>
131+
<param desc="The x position of the top-left corner of the cropped image in the source image." multiplicity="1" name="posX" type="int"/>
132+
</event>
133+
<event name="OnNewStatusCropPosY">
134+
<desc>Notify y position to crop image.</desc>
135+
<param desc="The y position of the top-left corner of the cropped image in the source image." multiplicity="1" name="poxY" type="int"/>
136+
</event>
137+
<event name="OnNewStatusCropWidth">
138+
<desc>Notify width of cropped image.</desc>
139+
<param desc="The width of the cropped image." multiplicity="1" name="width" type="int"/>
140+
</event>
141+
<event name="OnNewStatusCropHeight">
142+
<desc>Notify height of cropped image.</desc>
143+
<param desc="The height of the cropped image." multiplicity="1" name="height" type="int"/>
144+
</event>
145+
<event name="OnNewStatusRegisteredTransformationEvent">
146+
<desc>Notify event to receive transformation data to align image.</desc>
147+
<param desc="Name of event." multiplicity="1" name="eventName" type="string"/>
148+
</event>
149+
<event name="OnNewStatusTransformationSource">
150+
<desc>Notify source for transformation data.</desc>
151+
<param desc="Mode" multiplicity="1" name="mode" type="string"/>
152+
</event>
153+
<event name="OnNewStatusTransformationX">
154+
<desc>Notify manual transformation in x direction.</desc>
155+
<param desc="Transformation in x direction." multiplicity="1" name="xTrans" type="int"/>
156+
</event>
157+
<event name="OnNewStatusTransformationY">
158+
<desc>Notify manual transformation in y direction.</desc>
159+
<param desc="Transformation in y direction." multiplicity="1" name="yTrans" type="int"/>
160+
</event>
161+
<event name="OnNewStatusTransformationAngle">
162+
<desc>Notify manual transformation angle.</desc>
163+
<param desc="Transformation angle." multiplicity="1" name="angle" type="int"/>
164+
</event>
165+
<event name="OnNewStatusTransformationAngleOriginX">
166+
<desc>Notify transformation angle origin x position.</desc>
167+
<param desc="x position" multiplicity="1" name="xPos" type="int"/>
168+
</event>
169+
<event name="OnNewStatusTransformationAngleOriginY">
170+
<desc>Notify transformation angle origin y position.</desc>
171+
<param desc="y position" multiplicity="1" name="yPos" type="int"/>
172+
</event>
90173
<function name="setParameterName">
91174
<desc>Function to set the name of the parameters if saved/loaded via the CSK_PersistentData module.</desc>
92175
<param desc="Name of the parameter" multiplicity="1" name="name" type="string"/>
@@ -124,6 +207,7 @@ NUM will be replaced by the number of instance (e.g. "processInstance1"). +
124207
INFO: Other modules can check via "Script.isServedAsFunction" if function of sepecific instance exists. +
125208
Needs then to be called via "Script.callFunction".</desc>
126209
<param alias="Alias" desc="Transferred object (optional)" multiplicity="?" name="object" type="object"/>
210+
<param alias="Container" desc="Optional transformation data (xTrans, yTrans)" multiplicity="?" name="translation" type="object"/>
127211
<return desc="Processing result (optional)." multiplicity="?" name="result" type="bool"/>
128212
</function>
129213
<function name="addInstance">
@@ -133,15 +217,75 @@ Needs then to be called via "Script.callFunction".</desc>
133217
<desc>Function to reset instances to one single instance. +
134218
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>
135219
</function>
220+
<function name="setFilterType">
221+
<desc>Function to set filter type.</desc>
222+
<param desc="Filter type." multiplicity="1" name="filterType" ref="CSK_MultiImageFilter.ImageFilter" type="enum"/>
223+
</function>
224+
<function name="setShowImage">
225+
<desc>Function to select if image should be shown on UI.</desc>
226+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
227+
</function>
228+
<function name="setBlurKernelSizePix">
229+
<desc>Function to set kernel size of blur filter.</desc>
230+
<param desc="Size of the kernel. Must be positive." multiplicity="1" name="kernelSize" type="int"/>
231+
</function>
232+
<function name="setCannyThreshold">
233+
<desc>Function to set threshold range of canny filter.</desc>
234+
<param desc="Threshold" multiplicity="+" name="range" type="float"/>
235+
</function>
236+
<function name="setCropPosX">
237+
<desc>Function to set x position to crop image.</desc>
238+
<param desc="The x position of the top-left corner of the cropped image in the source image." multiplicity="1" name="posX" type="int"/>
239+
</function>
240+
<function name="setCropPosY">
241+
<desc>Function to set y position to crop image.</desc>
242+
<param desc="The y position of the top-left corner of the cropped image in the source image." multiplicity="1" name="posY" type="int"/>
243+
</function>
244+
<function name="setCropWidth">
245+
<desc>Function to set widht of cropped image.</desc>
246+
<param desc="The width of the cropped image." multiplicity="1" name="width" type="int"/>
247+
</function>
248+
<function name="setCropHeight">
249+
<desc>Function to set height of cropped image.</desc>
250+
<param desc="The height of the cropped image." multiplicity="1" name="height" type="int"/>
251+
</function>
252+
<function name="setRegisterTransformationEvent">
253+
<desc>Function to set event to receive transformation data to align image.</desc>
254+
<param desc="Event (needs to provide translation data as 'Transform' object)." multiplicity="1" name="event" type="string"/>
255+
</function>
256+
<function name="setTransformationSource">
257+
<desc>Function to set source of transformation data.</desc>
258+
<param desc="Source" multiplicity="1" name="source" ref="CSK_MultiImageFilter.TransformationSource" type="enum"/>
259+
</function>
260+
<function name="setTransformationX">
261+
<desc>Functin to set manual transformation in x direction.</desc>
262+
<param desc="Translation in x direction." multiplicity="1" name="x" type="int"/>
263+
</function>
264+
<function name="setTransformationY">
265+
<desc>Functin to set manual transformation in y direction.</desc>
266+
<param desc="Translation in y direction." multiplicity="1" name="y" type="int"/>
267+
</function>
268+
<function name="setTransformationAngle">
269+
<desc>Functin to set manual transformation angle.</desc>
270+
<param desc="Transformation angle in degree between -180 and +180." multiplicity="1" name="angle" type="int"/>
271+
</function>
272+
<function name="setTransformationAngleOriginX">
273+
<desc>Function to set xPos of origin for manual angle transformation.</desc>
274+
<param desc="x position" multiplicity="1" name="xPos" type="int"/>
275+
</function>
276+
<function name="setTransformationAngleOriginY">
277+
<desc>Function to set yPos of origin for manual angle transformation.</desc>
278+
<param desc="y position" multiplicity="1" name="yPos" type="int"/>
279+
</function>
136280
</serves>
137281
</crown>
138282
<meta key="author">SICK AG</meta>
139-
<meta key="version">0.1.0</meta>
283+
<meta key="version">1.0.0</meta>
140284
<meta key="priority">low</meta>
141285
<meta key="copy-protected">false</meta>
142286
<meta key="read-protected">false</meta>
143287
<meta key="crown2-flow-engine">false</meta>
144-
<meta key="LuaLoadAllEngineAPI">true</meta>
288+
<meta key="LuaLoadAllEngineAPI">false</meta>
145289
<entry default="CSK_Module_MultiImageFilter.lua" path="scripts"/>
146290
</application>
147291
</manifest>

CSK_Module_MultiImageFilter/scripts/CSK_Module_MultiImageFilter.lua

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222

2323
---@diagnostic disable: undefined-global, redundant-parameter, missing-parameter
2424

25-
-- See README file regarding StepByStep instruction to customize this template manually or make use of the cli renaming tool
26-
-- CreationTemplateVersion: X.X.X
25+
--
26+
-- CreationTemplateVersion: 3.5.0
2727
--**************************************************************************
2828
--**********************Start Global Scope *********************************
2929
--**************************************************************************
3030

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/MultiImageFilter/helper/checkAPIs') -- can be used to adjust function scope of the module related on available APIs of the device
34+
_G.availableAPIs = require('ImageProcessing/MultiImageFilter/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')
@@ -97,9 +97,18 @@ local function main()
9797
-- If so, the app will trigger the "OnDataLoadedOnReboot" event if ready after loading parameters
9898
--
9999
-- Can be used e.g. like this
100+
-- CSK_MultiImageFilter.setSelectedInstance(1)
101+
-- CSK_MultiImageFilter.setFilterType('Crop')
102+
-- CSK_MultiImageFilter.setRegisterEvent('CSK_MultiImageEdgeMatcher.OnNewAlignedImage1')
103+
--
104+
-- CSK_MultiImageFilter.addInstance()
105+
-- CSK_MultiImageFilter.setSelectedInstance(2)
106+
-- CSK_MultiImageFilter.setFilterType('Canny')
107+
-- CSK_MultiImageFilter.setRegisterEvent('CSK_MultiImageFilter.OnNewImage1')
108+
100109
----------------------------------------------------------------------------------------
101110

102-
--startProcessing() --> see above
111+
CSK_MultiImageFilter.setSelectedInstance(1)
103112
CSK_MultiImageFilter.pageCalled() -- Update UI
104113

105114
end

0 commit comments

Comments
 (0)