Operator View

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 evaluation of current image and optionally see other information or be able to enter/choose inputs, which can then be processed in Code.

Editor

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

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

Elements

The Root and Camera elements are always present in Operator View, but you have the option to add and customize other elements like Label, Input, Select or Slider.

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.

Visibility by key

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 Context is True. You can then set this key in Code based on your own rules.

E.g. this simple code sets visibility to True if image is evaluated as NG and to False if image is OK:

def main(context): context['visibility_key'] = not(context['result'])

Root

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 element shows the current view from camera - the same as you would see in the Camera tab. To see the evaluated view, evaluation needs to be enabled in some module and the Process option enabled in Camera tab.

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

Label

Label is an element which 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.

The source type parameter determines whether your text will be static (not changing) or dynamic (changing based on some variable in context).

If you choose static source type, you can enter your desired text in the Text field. This option where text is not changing can be useful to show some instructions, description etc.

If you choose dynamic source type you get the option to choose the context key which will contain the text to be displayed.

Then, you can change the specified context key in the 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 Code module, it will show text ‘True’ in the label if image is evaluated as OK and ‘False’ if image is evaluated as NG:

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

Input

Input element allows the operator to write any input text into a field, which can then be processed in 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 input, which can describe what the operator should input in this field, e.g. product type etc.

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 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 Code where you access it with (if target key is set to ‘input1’):

context['operatorInput']['input1']

If you want to have multiple inputs (or selects/sliders - explained below) in the operator view, you have to set different target key for each of them, so e.g. set one to ‘input1’ and the other to ‘input2’.

Select

Select element allows operator to select one of defined options and the chosen option can then be processed in 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.

Target Key is the key in 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 Code where you access it with (if target key is set to ‘input2’):

If you want to have multiple inputs/selects/sliders in the operator view, you have to set different target key for each of them, so e.g. set one to ‘input1’ and the other to ‘input2’.

Slider

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).

The Label can be used to describe what kind of value is set by the slider. Apart from position, you can also adjust the slider width and set visibility by key.

Disabling 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 Context which will contain the value which was selected by the slider at the time the image was processed. You can then work with this value in Code where you access it with (if target key is set to ‘input3’):

Open Operator View

When you finish configuring your operator view in Editor, you can go back to 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:

If you press Statistics, you can inspect how many images were processed and what was the success rate during the time between selected dates.