Skip to main content

Bretina - Python Image Testing Framework

Bretina is a python package designed to support testing of the images.

Intro

Bretina is designed as an extension of the python unit test module. Provides set of assertions which can be used to verify correctness of the image.

In typical application, content of the device LCD display is captured with a camera and Bretina is used to verify correctness of the defined regions in the image - such as region color, presence of an icon, correctness of the text representation and other aspects.

Documentation

can be found on https://docs.benderrobotics.com/bretina (Not publicly available ATM).

Download and install latest release

Bretina can be downloaded from within the internal BR network by calling:

    $ pip install bretina

For optical character recognition Bretina offers two engines:

To change the OCR engine set the bretina.OCR_ENGINE to either OcrEngine.TESSERACT or OcrEngine.PADDLE. By default OcrEngine.TESSERACT is set.

PaddleOCR local models

By default PaddleOCR downloads its models from the internet on first use. To use models bundled locally instead, install the models extra. The bretina-models package is hosted on the Bender Robotics private PyPI, so it has to be passed as the extra index:

    $ pip install bretina[models] --extra-index-url https://pypi.benderrobotics.com

When the bretina-models package is available, PaddleOCR automatically uses the local models instead of downloading them.

Tesseract usage

To utilize Tesseract, it has to be installed as a standalone application and registered into system PATH. Installation files can be downloaded from https://github.com/tesseract-ocr/tesseract (tested with Tesseract version 5). Windows installer is provided by Mannheim University Library at https://github.com/UB-Mannheim/tesseract/wiki.

After the installation, add path to the tesseract.exe to your system PATH.

For the best OCR performance install the slower, but more accurate datasets tessdata_best (https://github.com/tesseract-ocr/tessdata_best). Extract the downloaded archive into the installation directory of the tesseract OCR.

This is an expected structure of the tesseract installation directory:

  • C:\Program Files\Tesseract-OCR- tesseract installation
    • \tessdata - original tessdata dataset
      • afr.traineddata
      • ...
    • \tessdata_best - extracted best dataset
      • afr.traineddata
      • ...

Building Bretina from the source

If you want to build Bretina from the source, you need to clone the repository first. Then checkout to devel branch to get the latest version, or to feature/* branches for the cutting edge versions.

    $ git checkout devel

For building the python wheel, we use GNU make.

make expects that your pip3 installation will be available under pip command. Also there is a possibility that setup.py may fail on bdist_wheel as an not known argument. To fix this, install wheel package again.

Navigate to top-level directory of the cloned repository and you will be able to use the following commands:

    $ make install    # First time Bretina installation. It will build the source and install it using pip
    $ make reinstall  # Pulled new commit? Use this to build new wheel, uninstall and install the new version using pip
    $ make all        # Just builds the wheel
    $ make clean      # Cleans the build directories and files

Builded wheel is located in Bretina/dist/.

Installing make

On Ubuntu like machines execute the following command:

    $ sudo apt install make

If you are on windows machine, you can install a MinGW. In the MinGW installer choose mingw32-base-bin and msys-base-bin packages, then click on Installation and Apply changes. Don't forget to add the make binary to the system PATH. Default install location should be C:\MinGW\msys\1.0\bin\.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bretina-0.8.1.tar.gz (54.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bretina-0.8.1-py3-none-any.whl (53.5 kB view details)

Uploaded Python 3

File details

Details for the file bretina-0.8.1.tar.gz.

File metadata

  • Download URL: bretina-0.8.1.tar.gz
  • Upload date:
  • Size: 54.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.17

File hashes

Hashes for bretina-0.8.1.tar.gz
Algorithm Hash digest
SHA256 b41edf7f39a084ee7001b2abfb2f1827d4b9da09ab1d9b3dcd6891ac3d2dad5f
MD5 81fe02a1721dc958d62322b72a92188b
BLAKE2b-256 41072fa550e0c7c4a6602efb2d9f53d3606b37ad3832ed3db49b0ad6ab24c9e2

See more details on using hashes here.

File details

Details for the file bretina-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: bretina-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 53.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.17

File hashes

Hashes for bretina-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9e66553fedf8500b0113698160a014e3f01782fdfe96b40db00656b632a1c8eb
MD5 92be88304f239ebfed19f856e8993a81
BLAKE2b-256 f7c1c0ec7590758f2f9d799cc2a12e418e81033e2d06cba5bf8a9f4ba07273a8

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.0

2 files

This release

0.8.1 This release

2 files

0.8.0

2 files

0.7.6

2 files

0.7.5

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page