Rapid OpenCV prototyping with PyFlowOpenCV

Changbo Yang
Rapid OpenCV prototyping with PyFlowOpenCV
4 min readJun 27, 2020

PyFlowOpenCv is a easy to use rapid prototyping GUI tool for OpenCV. PyFlowOpenCV enable you learn Computer vision without writing a single line of code, which is great for rapid prototyping and learning. Plenty of OpenCV functions are available as building blocks in PyFlowOpenCv that can be combined in a graphical user interface with just a few mouse clicks. A quick demo on how PyFlowOpenCv works for a face detection.

PyFlow is a general-purpose Visual Dataflow Programming library. Nodes represent algorithms with certain inputs and outputs. Connections transfer data from the output (source) of the first node to the input (sink) of the second one. PyFlowOpencv is a visual scripting extension for PyFlow for OpenCV.

Goal

Learning OpenCV is quite challenging for most of the beginners. PyFlowOpenCv make the learning curve of OpenCv much smoother. You do not need to write any code, just drag and drop the diagram.

OpenCV comes with GUI tools like Highui and OpenCVGUI, but they are far from user friendly. You still need to write a lot of code to use them. With PyFlowOpenCV, user can focus on build the computer vision pipeline and fine tune the parameters, instead of writing boilerplate source code.

Installation

PyFlowOpenCv is not a standalone software, it is a extension package of PyFlow. PyFlow has to be installed first. You can refer to PyFlow to install PyFlow. After PyFlow installed through pip or setup.py.

The easy way to install PyFlow is:

pip install git+https://github.com/wonderworks-software/PyFlow.git@master

Clone or download repository to a local folder:

git clone https://github.com/bobosky/PyFlowOpenCv

Install requirements for your use case:

pip install -r requirements.txt

To run the program in standalone mode, run pyflow.py in the root folder of PyFlow project. You can also invoke pyflow.exe on windows or pyflow on unix OS. Program is located inside PATH/TO/PYTHON/Scripts.

You can enable the PyFlowOpenCv package by one the of following ways.

  • addition package on preferences dialog. Make sure you add path of PyFlow/Packages under PyFlowOpenCv project to the ‘additional package location’ edit.
  • Copy the PyFlowOpenCv package to .PyFlow/Packages
  • User can add location of package to env variable for PYTHONPATH
  • Paths listed in PYFLOW_PACKAGES_PATHS env variable (; separated string)

If everything works out, you should able to see ‘PyFlowOpenCv’ in your NodeBox dialog of the GUI.

PyFlowOpenCV implemented lots of functionality from OpenCV, like image/video input/output, image filter, image transformation, background detection, feature matching, histogram, motion history, optical flow, shape fitting and deep learning. And more modules will be added to PyFlowOpenCv. In this post, I will provide some example of using deep learning from OpenCV to detect text from image and detect objects.

Text Detection by deep learning

EAST Detector for Text Detection

OpenCV’s EAST(Efficient and Accurate Scene Text Detection ) text detector is a deep learning model, based on a novel architecture and training pattern. It is capable of running at near real-time at 13 FPS on 720p images and obtains state-of-the-art text detection accuracy.

Link to paper

OpenCV’s text detector implementation of EAST is quite robust, capable of localizing text even when it’s blurred, reflective, or partially obscured. To create a diagram for EAST text detector, we need to drag a ‘text_detection_dnn’ block from ‘NodeBox’ to diagram.

This is an example of text detection on a webcam.

YOLO object detection with OpenCV

You only look once (YOLO) is a state-of-the-art, real-time object detection system. On a Pascal Titan X it processes images at 30 FPS and has a mAP of 57.9% on COCO test-dev.

Due to the large size of the yolo model file, PyFlowOpenCV only includes a tiny yolo model with the package.

You can also use YOLO detector on realtime webcam.

If you want to learn more about how to use the PyFlowOpenCV, please refer to the documentation

Getting Started

We have documentation

Authors

Pedro CabreraPedro Cabrera

Changbo YangChangbo Yang

See also the list of contributors who participated in this project.

Discussion

Join us to our discord channel and ask anything related to project! Please also let us know if you want more OpenCV features in PyFlowOpenCv.

--

--