View Thermal images for analysis in Machine Learning
Simple code to display grayscale thermal images
Published in
Aug 1, 2021
Thermal images are used in different fusion techniques for Object detection in Autonomous Vehicles (AVs). These images are in grayscale. We can use simple code in Python to view these images for analysis. There are some publicly available datasets that have Thermal images for machine learning in AVs.
# open cv
import cv2# plotting library
import matplotlib.pyplot as pltimage = cv2.imread('flir_thermal.jpeg', 0)
colormap_image = cv2.applyColorMap(image, cv2.COLORMAP_TWILIGHT_SHIFTED)
plt.figure()
plt.imshow(colormap_image)
plt.show()
CV2 has the following Color Maps:
COLORMAP_AUTUMN
COLORMAP_BONE
COLORMAP_JET
COLORMAP_WINTER
COLORMAP_RAINBOW
COLORMAP_OCEAN
COLORMAP_SUMMER
COLORMAP_SPRING
COLORMAP_COOL
COLORMAP_HSV
COLORMAP_PINK
COLORMAP_HOT
COLORMAP_PARULA
COLORMAP_MAGMA
COLORMAP_INFERNO
COLORMAP_PLASMA
COLORMAP_VIRIDIS
COLORMAP_CIVIDIS
COLORMAP_TWILIGHT
COLORMAP_TWILIGHT_SHIFTED
COLORMAP_TURBO
COLORMAP_DEEPGREEN
The following sample images can be downloaded from here.
Thank you for reading! Please 👏and follow me if you liked this post, as it encourages me to write more!