I am converting a pixel values to temp (values of a thermal image). But after conversion output image is not except able. Here is my code:
import cv2
import numpy as np
import matplotlib.pyplot as plt
#Thermal image
img = cv2.imread('IR2.bmp',0)
print(img)
pixel=np.asarray(img)
# storing in pixel array
for i in range(0,img.shape[0]):
for j in range(0,img.shape[1]):
print(pixel[i][j])
# converting pixel value to temperature values
r,c=(230,304)
arr = np.zeros([230,304])
for i in range(0,img.shape[0]):
for j in range(0,img.shape[1]):
arr[i][j] = 9.2+(pixel[i][j]/255)*26.2
print(arr)
# showing the converted image
cv2.imshow('converted',arr)
cv2.waitKey(0)
cv2.destroyAllWindows()
arr = 9.2 + (img/255) * 26.2
- withoutnp.asarray
,np.zeros
,for
-loops. But it gives the same values which are too small and they all looks like white color. $\endgroup$