Versions Compared

Key

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

...

Widget Connector
overlayyoutube
_templatecom/atlassian/confluence/extra/widgetconnector/templates/youtube.vm
width680px
urlhttps://www.youtube.com/watch?v=WkEYKFe9wMo&feature=youtu.be
height400px

Structure

The main method is ‘main(context, module_item)’. Its role is to edit the context that comes in as a parameter. Additional auxiliary methods can be added to the code. Standard libraries can be imported, typically together with the ‘cv2’ library. In the context, the image is under the ‘image’ attribute and its structure is a numpy array, see OpenCV documentation.

...

Code Block
import cv2

def main(context, module_item):
    context['image'] = cv2.resize(context['image'], None, fx=0.5, fy=0.5)

Early Flow Termination

If the ‘exit’ attribute is set to ‘True’ in the context, the subsequent modules are skipped. If the code uses parallelism, only the current branch is terminated.

...

Code Block
import cv2

def main(context, module_item):
    if len(context['detectedRectangles']) == 0:
        context['exit'] = True

OpenCV

To work with the image, you can use the OpenCV library offering a variety of editing methods.

Console

Some errors and text outputs can be seen in the console which can be enabled by the ‘show console’ button.