Hi I am trying to get temperature from my thermal camera, which is Lepton 3.5 radiometric. Currently, I am having a reading of pixel values array from the mask rectangle.
The code goes like this:
heatmap_gray = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
heatmap = cv2.applyColorMap(heatmap_gray, cv2.COLORMAP_HOT)
# Binary threshold
_, binary_thresh = cv2.threshold(heatmap_gray, threshold, 255, cv2.THRESH_BINARY)
# Image opening: Erosion followed by dilation
kernel = np.ones((3, 3), np.uint8)
image_erosion = cv2.erode(binary_thresh, kernel, iterations=1)
image_opening = cv2.dilate(image_erosion, kernel, iterations=1)
# Get contours from the image obtained by opening operation
contours, _ = cv2.findContours(image_opening, 1, 2)
image_with_rectangles = np.copy(frame)
for contour in contours:
# rectangle over each contour
x, y, w, h = cv2.boundingRect(contour)
# Pass if the area of rectangle is not large enough
if (w) * (h) < area_of_box:
continue
# Mask is boolean type of matrix.
mask = np.zeros_like(heatmap_gray)
cv2.drawContours(mask, contour, -1, 255, -1)
max = convert_to_temperature(np.amax(heatmap_gray+mask))
print(heatmap_gray+mask)
It gets an array like this: pixel values
I want to extract temperature values and get their max,min, and mean like this: Temperature values