当前位置:网站首页>MLX90640 红外热成像仪测温模块开发笔记(四)
MLX90640 红外热成像仪测温模块开发笔记(四)
2022-07-25 09:23:00 【河北稳控科技】
MLX90640 红外热成像仪测温模块开发笔记(四)损坏和不良像素的处理
如前“开发笔记(一)”所说,MLX90640 可能存在不超过 4 个像素的损坏或者不良像素,在温度计算过程完成后,这些不良像素点会得到错误的温度数据,对于处理这些不良数据 MLX 也给出了推荐方法和具体的函数。(其实就是找相邻的正常的温度数据取平均来代替不良数据)

前面开发笔记(一)的内容中所说的 API 库,里面缺少了对不良像素点的处理函数,在这里补上。
int CheckAdjacentPixels(uint16_t pix1, uint16_t pix2)
{
int pixPosDif;
pixPosDif = pix1 - pix2;
if(pixPosDif > -34 && pixPosDif < -30)
{
return -6;
}
if(pixPosDif > -2 && pixPosDif < 2)
{
return -6;
}
if(pixPosDif > 30 && pixPosDif < 34)
{
return -6;
}
return 0;
}
float GetMedian(float *values, int n)
{
float temp;
for(int i=0; i<n-1; i++)
{
for(int j=i+1; j<n; j++)
{
if(values[j] < values[i])
{
temp = values[i]; values[i] = values[j]; values[j] = temp;
}
}
if(n%2==0)
{
return ((values[n/2] + values[n/2 - 1]) / 2.0);
}
else
{
}
return values[n/2];
}
int IsPixelBad(uint16_t pixel,paramsMLX90640 *params)
{
for(int i=0; i<5; i++)
{
if(pixel == params->outlierPixels[i] || pixel == params->brokenPixels[i])
{
return 1;
}
}
return 0;
}
void MLX90640_BadPixelsCorrection(uint16_t *pixels, float *to, int mode, paramsMLX90640
*params)
{
float ap[4]; uint8_t pix; uint8_t line; uint8_t column;
pix = 0;
while(pixels[pix] != 0xFFFF)
{
line = pixels[pix]>>5;
column = pixels[pix] - (line<<5);
if(mode == 1)
{
if(line == 0)
{
if(column == 0)
{
to[pixels[pix]] = to[33];
}
else if(column == 31)
{
}
else
{
}
}
to[pixels[pix]] = to[62];
to[pixels[pix]] = (to[pixels[pix]+31] + to[pixels[pix]+33])/2.0;
else if(line == 23)
{
if(column == 0)
{
to[pixels[pix]] = to[705];
}
else if(column == 31)
{
}
else
{
}
}
to[pixels[pix]] = to[734];
to[pixels[pix]] = (to[pixels[pix]-33] + to[pixels[pix]-31])/2.0;
else if(column == 0)
{
to[pixels[pix]] = (to[pixels[pix]-31] + to[pixels[pix]+33])/2.0;
}
else if(column == 31)
{
}
else
{
to[pixels[pix]] = (to[pixels[pix]-33] + to[pixels[pix]+31])/2.0;
ap[0] = to[pixels[pix]-33];
ap[1] = to[pixels[pix]-31]; ap[2] = to[pixels[pix]+31]; ap[3] = to[pixels[pix]+33];
to[pixels[pix]] = GetMedian(ap,4);
}
else
{
}
if(column == 0)
{
to[pixels[pix]] = to[pixels[pix]+1];
}
else if(column == 1 || column == 30)
{
to[pixels[pix]] = (to[pixels[pix]-1]+to[pixels[pix]+1])/2.0;
}
else if(column == 31)
{
}
else
{
0)
to[pixels[pix]] = to[pixels[pix]-1];
if(IsPixelBad(pixels[pix]-2,params) == 0 && IsPixelBad(pixels[pix]+2,params) ==
{
ap[0] = to[pixels[pix]+1] - to[pixels[pix]+2]; ap[1] = to[pixels[pix]-1] - to[pixels[pix]-2];
if(fabs(ap[0]) > fabs(ap[1]))
{
}
else
{
}
else
{
}
to[pixels[pix]] = to[pixels[pix]-1] + ap[1];
to[pixels[pix]] = to[pixels[pix]+1] + ap[0];
to[pixels[pix]] = (to[pixels[pix]-1]+to[pixels[pix]+1])/2.0;
}
}
}
pix = pix + 1;
}
}
用法很简单,在开发笔记(三)MLX90640_CalculateTo(Frame, MLXPars, 0.95, Tr, Temp);之后添加两行即可。如下(斜体是添加的内容):
……
MLX90640_CalculateTo(Frame, MLXPars, 0.95, Tr, Temp); MLX90640_BadPixelsCorrection(MLXPars.brokenPixels, Temp, 1, MLXPars); MLX90640_BadPixelsCorrection(MLXPars.outlierPixels, Temp, 1, MLXPars);
……
/*
经过上面的处理后,Temp 中的损坏和不良像素点已经处理,Temp 数组中是处理完成后的
768 个温度值。
*/

边栏推荐
- A number converted from a decimal integer to another base
- How to import a large amount of data in MATLAB
- 深度估计自监督模型monodepth2在自己数据集的实战——单卡/多卡训练、推理、Onnx转换和量化指标评估
- 初识Opencv4.X----图像直方图绘制
- First knowledge of opencv4.x --- image histogram matching
- 1094 - Google recruitment
- Matlab drawing | some common settings of axis
- How to import a large amount of data in MATLAB
- TensorFlow raw_rnn - 实现seq2seq模式中将上一时刻的输出作为下一时刻的输入
- 基于PackNet的演进——丰田研究院(TRI)深度估计文章盘点(下)
猜你喜欢

深度估计自监督模型monodepth2论文总结和源码分析【理论部分】

Mixed supervision for surface-defect detection: from weakly to fully supervised learning:表面缺陷检测的混合监督

初识Opencv4.X----方框滤波

Mixed supervision for surface defect detection: from weakly to fully supervised learning

单目深度估计自监督模型Featdepth解读(上)——论文理解和核心源码分析

CCF 201509-3 模板生成系统

Evolution based on packnet -- review of depth estimation articles of Toyota Research Institute (TRI) (Part 2)

Creation of adjacency table of undirected connected graph output breadth depth traversal

Hyperautomation for the enhancement of automation in industries 论文翻译

【RNN】剖析RNN 之 从RNN-(Simple|LSTM) 到 序列生成 再到 seq2seq框架(encoder-decoder,或称为seq2seq)
随机推荐
Gartner 2022年顶尖科技趋势之超级自动化
Mixed supervision for surface defect detection: from weakly to fully supervised learning
【深度学习模型部署】使用TensorFlow Serving + Tornado部署深度学习模型
How to add other PHP versions to MAMP
【数据挖掘】第四章 分类任务(决策树)
matlab如何导入大量数据
CDA Level1复盘总结
@2-1 safety index predicted by CCF at the end of December 1, 2020
1094--谷歌的招聘
First knowledge of opencv4.x --- image histogram equalization
How to install pytorch—— A most simple and effective method!
CDA Level1知识点总结之业务分析报告与数据可视化报表
AMD EPYC 9664旗舰规格曝光:96核192线程 480MB缓存 3.8GHz频率
Customize the view to realize the background of redeeming lottery tickets [elementary]
从Anaconda到TensorFlow到Jupyter一路踩坑一路填平
@3-1 CCF 2020-09-1 scale detection point query
UI prototype resources
无向连通图邻接矩阵的创建输出广度深度遍历
First knowledge of opencv4.x --- image convolution
[deep learning] self encoder