简易无接触温度测量与身份识别装置(F题)
方案选择
本设计无接触温度测量模块由STC89C52单片机电路+1602液晶显示电路+MLX90614ESF红外非接触温度检测电路+按键电路+蜂鸣器报警电路。
身份识别模块的选择:使用K210+NT35310液晶显示屏+OV5640摄像头模块。 K210是基于RISC-V精简指令集的一款MCU,芯片架构包含了一个神经网络硬件加速器KPU,可以高性能地进行卷积神经网络运算,可以更好地在机器视觉和听觉上发挥作用。从传统的人工设计特征加浅层分类器的框架,到基于深度学习的端到端的检测框架。通过创建被识别对象(参赛队3名队员,以及口罩防疫识别)的数据集,之后进行深度学习及算法训练。
无接触温度测量系统
main.c
#include<reg52.h>
#include<stdio.h>
#include<intrins.h>
#include "delay.h"
#include "1602.h"
#include "mlx90614.h"
sbit buzzer=P1^0;
sbit key1=P2^0;
sbit key2=P2^1;
unsigned long time_20ms;
char dis0[16];
char dis1[16];
unsigned int setNum = 37;
bit rekey =0;
bit disFlag =0;
unsigned int Tem;
float objTemp,envTemp;
void Init_Timer0(void);
void main (void)
{
Init_Timer0();
LCD_Init();
DelayMs(20);
LCD_Clear();
while (1)
{
if(disFlag==1)
{
Tem=ReadObjectTemp();
objTemp=(float)(Tem)*0.02-273.15;
Tem=ReadEnvironTemp();
envTemp=(float)(Tem)*0.02-273.15;
sprintf(dis0,"E: %4.1f'C ",envTemp);
LCD_Write_String(0,0,dis0);
sprintf(dis1,"O:%5.1f'C %3d ",objTemp,setNum);
LCD_Write_String(0,1,dis1);
if(objTemp>setNum)
{buzzer =0; }
else
{buzzer=1;}
disFlag = 0;
}
if((key1 == 0)||(key2 == 0))
{
if(rekey == 0)
{
DelayMs(10);
if(key1 == 0)
{
rekey =1;
if(setNum<200) setNum++;
}
else if((key2 == 0))
{
rekey =1;
if(setNum>0) setNum--;
}
}
}
else
{
rekey = 0;
}
}
}
void Init_Timer0(void)
{
TMOD |= 0x01;
TH0=(65536-20000)/256;
TL0=(65536-20000)%256;
EA=1;
ET0=1;
TR0=1;
}
void Timer0_isr(void) interrupt 1
{
TH0=(65536-20000)/256;
TL0=(65536-20000)%256;
time_20ms++;
if(time_20ms%20==0)
{disFlag = 1;}
}
人脸控制系统
操作过程: 操作过程放在文章末尾资料链接中!!!
代码块
kpu_image.pixel = 3;
kpu_image.width = 320;
kpu_image.height = 240;
image_init(&kpu_image);
display_image.pixel = 2;
display_image.width = 320;
display_image.height = 240;
image_init(&display_image);
crop_image.pixel = 3;
crop_image.width = 224;
crop_image.height = 224;
image_init(&crop_image);
dvp_set_ai_addr((uint32_t)kpu_image.addr, (uint32_t)(kpu_image.addr + 320 * 240), (uint32_t)(kpu_image.addr + 320 * 240 * 2));
dvp_set_display_addr((uint32_t)display_image.addr);
dvp_config_interrupt(DVP_CFG_START_INT_ENABLE | DVP_CFG_FINISH_INT_ENABLE, 0);
dvp_disable_auto();
printf("DVP interrupt config\n");
plic_set_priority(IRQN_DVP_INTERRUPT, 1);
plic_irq_register(IRQN_DVP_INTERRUPT, dvp_irq, NULL);
plic_irq_enable(IRQN_DVP_INTERRUPT);
if (kpu_load_kmodel(&task1, model_data) != 0)
{
printf("Cannot load kmodel.\n");
exit(-1);
}
sysctl_enable_irq();
printf("System start\n");
while (1)
{
g_dvp_finish_flag = 0;
dvp_clear_interrupt(DVP_STS_FRAME_START | DVP_STS_FRAME_FINISH);
dvp_config_interrupt(DVP_CFG_START_INT_ENABLE | DVP_CFG_FINISH_INT_ENABLE, 1);
while (g_dvp_finish_flag == 0)
;
image_crop(&kpu_image, &crop_image, 48, 8);
g_ai_done_flag = 0;
if (kpu_run_kmodel(&task1, crop_image.addr, DMAC_CHANNEL5, ai_done, NULL) != 0)
{
printf("Cannot run kmodel.\n");
exit(-1);
}
while (!g_ai_done_flag);
float *features;
size_t output_size;
kpu_get_output(&task1, 0, &features, &output_size);
size_t cls = argmax(features, 2);
const char *text = NULL;
switch (cls)
{
case 0:
text = "people1";
break;
case 1:
text = "people2";
break;
case 2:
text = "people3";
break;
}
if (features[cls] > PROB_THRESH)
ram_draw_string(display_image.addr, 150, 20, text, RED);
lcd_draw_picture(0, 0, 320, 240, (uint32_t *)display_image.addr);
}
}
资料:
资源链接!!!https://download.csdn.net/download/wangshuqian1314/85206253
|