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

...

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.

...

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.

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.

...

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

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

...

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

...

E.g. if you enter this simple code in 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 NG:

...

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 the target key is set to ‘input1’):

...

Select

Select element allows the operator to select one of the 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 the target key is set to ‘input2’):

...

The Label can be used to describe what kind of value is set by the slider. Apart from the 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 the target key is set to ‘input3’):

...