Thermal Camera (Thermo AI Device TiD) Python Acceleration

OpenCV is used for image processing in MH Software & Service. In order to consider the fastest processing method on Raspberry Pi, we are comparing the processing speed of OpenCV and numpy.


  1. Introduction
  2. Sensor
  3. Sensor case
  4. Raspberry Pi
  5. Python 5.1 Form 5.2 OMRON Non-contact Temperature Sensor D6T-44L-06 Edition 5.3 Pololu ranging sensor VL53L0X edition 5.4 BOSCH Temperature / Humidity / Barometric Pressure Sensor BME280 5.5 Shutdown / Restart Switch Edition 5.6 OpenCV 5.7 Speedup

Benchmark results

We processed each process 500,000 times, investigated which was faster, and adopted the faster one to speed up the processing of the TiD thermo AI device TiD.

import cv2
import numpy as np

#Please decide the file name appropriately
file_name = "test.jpg "

img = None
org = cv2.imread(file_name)

for i in range(500000):
    # Resize: OpenCV is fast.
    #img = cv2.resize(org, (300,300), cv2.INTER_CUBIC)
    #img = cv2.resize(org, dsize=(300,300))
    #img = org.repeat(2, axis=0).repeat(2, axis=1)

    # Frip: OpenCV is fast.
    #img = cv2.flip(org, 1)
    #img = np.fliplr(org)

    # BGR to RGB: Numpy is fast.
    #img = org
    #img = cv2.cvtColor(org, cv2.COLOR_BGR2RGB)
    #img = org[:, :, ::-1]

    # Grayslace: OpenCV is fast.
    #img = cv2.cvtColor(org, cv2.COLOR_BGR2GRAY)
    #img = 0.299 * org[:, :, 0] + 0.587 * org[:, :, 1] + 0.114 * org[:, :, 2]

    # Rotate: OpenCV is fast.
    #img = np.rot90(org)
    #img = cv2.rotate(org, cv2.ROTATE_90_CLOCKWISE) #2.99[sec]

YouTube: Thermal Camera (Thermo AI Device TiD) Python Edition web: Thermo AI Device TiD Python Acceleration (URL is subject to change.)

Recommended Posts

Thermal Camera (Thermo AI Device TiD) Python Acceleration
Thermal Camera (Thermo AI Device TiD) Python Form
Thermal camera (Thermo AI device TiD) Python BME280
Thermal Camera (Thermo AI Device TiD) Python OpenCV Edition
Thermal camera (thermo AI device TiD) Python VL53L0X edition
Thermal Camera (Thermo AI Device TiD) Python D6T-44L-06 Edition
Thermal Camera (Thermo AI Device TiD) Introduction
Thermal camera (Thermo AI device TiD) Sensor edition
Thermal Camera (Thermo AI Device TiD) Raspberry Pi Edition