python code matrix infrared temperature, temperature data into pictures saved in PNG format
Blog Description
This blog is the temperature of the matrix will be saved in txt file into png save format
Providing matrix txt file reference temperature used and the transformation code python
Temperature txt file
This data is a 160x120 matrix infrared temperature, I put Baidu network disk, put the blog here directly accounted for nearly 10W of words on a card to open.
https://pan.baidu.com/s/1mgqHJb700_uLasywaPVNWA
Password: 2bah
put two pictures to let everyone take a look at what data
Temperature data matrix of 160 rows of 120 temperature data, each row of data storage wrap, a comma separating each temperature data
Pictures temperature matrix transpose method
It provides two methods here, the first one is implemented in python inside the library, and the second is for people not using python environment test (have execl)
First, the use python to save the temperature data as a picture
python understand the small partners understand, do not do too much to explain, directly on the code
directly in one step inside the image library to save the image generated, self-study
#!/usr/bin/env python
import cv2
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import matplotlib
f = open(r"HWdata.txt")
val_list = f.readlines()
lists =[]
for string in val_list:
string = string.split(',')
lists.append(string[0:120])
a = np.array(lists)
a= a.astype(float)
a = np.array(a).reshape(160, 120)
#####
#interpolation=nearest 插值
#origin=upper 镜像
#cmap=plt.cm. jet\hsv\hot\cool\spring\summer\autumn\winter\gray\bone\copper\pink\lines
#####
#plt.imshow(a,interpolation='nearest',cmap=plt.cm.hot,origin='upper')
plt.imshow(a,interpolation='None',cmap=plt.cm.gray,origin='upper')
#温标 shrink=0.8
plt.colorbar()
plt.xticks(())
plt.yticks(())
plt.show()
#保存图片
#matplotlib.image.imsave('test.png',a)
Second, the use of the storage temperature execl image data
1, temperature data on execl txt file in
here is the data on a line 160 a
2, a splitting temperature data out line 160, switch 120 to 160 rows
click data in execl - disaggregated
selected delimiter click Next
select comma, click Next
finally click completed, can be obtained in the 160 OK 120 execl temperature data
3, color temperature data attached
first, select all the cells in the cell down to the pixel value of 1
(this does not know what method is better, it will not use execl, the method I use is to click on the small triangle for the upper left corner of the cell and then drag him pixels value of 1)
This step may not operate, so that only the other colors out of the picture will be relatively large to be attached stretched as far as possible also inflicted square cell line
You can check the top left click the small triangle to check the amount of data right
here, see the pictures, but the lower right corner count display is 19200, just 160x120
data no problem, proceed to the next color
we select all the data in the state in the beginning of Tina and conditional formatting, click New rule
for me the figure below, the format for the three-color scale, 50% of a middle gray color selection, maximum and minimum can be configured as a black and white set in the rules
determining click to generate infrared temperature consisting of a map, you can choose the color, this preservation method to explore on their own, I do not know much about execl
If you execl this cell are set to become one described above, it can be directly copied data to the display directly above
To summarize
second method is mainly for people to use extreme is not recommended, if you need additional temperature data upload some I get free, I wish you all a Happy New Year, point a praise it.