Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Operator View is intended to give you an opportunity to design a simple UI for your line operators, where they can view the camera with an evaluation of the current image and optionally see other information or be able to enter/choose inputs, which can then be processed in /wiki/spaces/KB3141/pages/533529462 Code.

Editor

Editor is the place where you can design, how the Operator View should look - determine what elements it should contain and customize its position, style, and function.

You can get to it from the Camera tab by selecting Operator View > Open Editor Edit.

...

Elements

The Root, Camera, and Camera counter elements are always present in the Operator View, but you have the option to add and customize other elements like Label, Input, Select, Slider, or Image., Image, or other counters. The default counters are used for counting the number of bad, good, and all images, but they can be deleted or changed.

...

Info

Position of element can be changed not only by entering specific X and Y number in its settings, but also by clicking on the element and dragging it around the view.

...

This is a parameter for optional elements, which allows you to determine that a certain element will be visible only if the specified key in /wiki/spaces/KB3141/pages/533529551 Context is True. You can then set this key in Code based on your own rules.

...

Root is the main element in which all the other elements are contained. You are able to choose the background color of the root element.

...

Camera

Camera The camera element shows the current view from the camera - the same as you would see in the Camera tab. To see the evaluated view, evaluation needs to be enabled in some any module and the Process option enabled in the Camera tab.

You can customize the position and size of the area where the camera should be shown and also turn Rectangles on and off.

...

Label

Label The label is an element that allows you to show text to the operator.

The basic settings you can choose are position, background color, text color, offset from the edge of the label-rectangle, and also font size and visibility by key.

...

If you choose dynamic source type you get the option to choose the /wiki/spaces/KB3141/pages/533529551 context key which will contain the text to be displayed.

...

Then, you can change the specified context key in the /wiki/spaces/KB3141/pages/533529462 Code module for each processed image and the value the key currently has will be shown in the Label in Operator View.

E.g. if you enter this simple code in the /wiki/spaces/KB3141/pages/533529462 Code module, it will show the text ‘True’ in the label if an image is evaluated as OK and ‘False’ if an image is evaluated as NOK:

Code Block
languagepy
def main(context):
    context['label_key'] = str(context['result'])

Input

Input The input element allows the operator to write any input text into a field, which can then be processed in /wiki/spaces/KB3141/pages/533529462 Code.

...

The basic settings you can choose are position, background color, text color, width, font size, and visibility by key.

...

Enable Max Length option lets you limit the number of characters the operator is allowed to input into this field.

...

Target Key is the key in /wiki/spaces/KB3141/pages/533529551 Context which will contain the value which was entered in this field at the time the image was processed. You can then work with this value in /wiki/spaces/KB3141/pages/533529462 Code where you access it with (if the target key is set to ‘input1’):

...

Select element allows the operator to select one of the defined options and the chosen option can then be processed in /wiki/spaces/KB3141/pages/533529462 Code.

...

The basic settings you can choose are position, background color, text color, width, font size, and visibility by key.

You can also set the Label text for this select, which can describe what the operator should select in this field, e.g. product type, etc.

Slider

Slider The slider element allows the operator to select a number from a given range set with min and max. Either by using the slider itself or the text field next to it (if enabled by Show text field).

...

Disabling the text field can be used e.g. when trying to make an “on/off switch” between 0 and 1, otherwise, the text field is needed for showing the set value.

Target Key is the key in /wiki/spaces/KB3141/pages/533529551 Context which will contain the value which was selected in this field at the time the image was processed. You can then work with this value in /wiki/spaces/KB3141/pages/533529462 Code where you access it with (if the target key is set to ‘input2’):

...

When you finish configuring your operator view in Editor, click on Save and go back to the Camera tab and select Operator View > Open operator View, then a window like this will open (with elements as you defined them in Editor) and the operator can start interacting with it:

...

Info

For images you saved (when you had ‘Save images’ enabled or you ‘Captured' the image while the Operator View was running) you can see the operator inputs at that time in the /wiki/spaces/KB3141/pages/534446081 Inspection tab under 'operatorInput’ key, which is a dictionary containing key-value pairs for all your inputs/selects/sliders.

If you set some dynamic label, you can see the value of its context key (if you set its value in code) at that time under the context key name you selected, so e.g. 'label_key' in this example.

If you set visibility by key for some element and you set its value in code, you will see it here too under the name you selected for the key so e.g. ‘visibility_key’ in this example.

...