This commit is contained in:
Glz
2023-12-17 16:23:13 +08:00
12 changed files with 581 additions and 549 deletions

View File

@@ -34,6 +34,9 @@
********************************************************************************************************************/
#include "zf_common_headfile.h"
#include "gl_headfile.h"
#include "cw_servo.h"
#include "by_pt_button.h"
#include "by_fan_control.h"
uint8 (*Img_Gray)[MT9V03X_W]; // <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MT9V03X_W <20>е<EFBFBD> uint8 <20><><EFBFBD>͵Ķ<CDB5>ά<EFBFBD><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
//uint8 *mt9v03x_image_copy[0]; // <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8> uint8 <20><><EFBFBD>͵<EFBFBD>һά<D2BB><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
@@ -49,7 +52,6 @@ float32 mid_left[PT_MAXLEN][2], mid_right[PT_MAXLEN][2];
sint32 mid_left_count, mid_right_count;
//<2F><><EFBFBD>ұ<EFBFBD><D2B1>߾ֲ<DFBE><D6B2>Ƕȱ仯<C8B1><E4BBAF>+<2B>Ǽ<EFBFBD><C7BC><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
float angle_new_left[PT_MAXLEN];
float angle_new_right[PT_MAXLEN];
@@ -88,15 +90,18 @@ int frame_count = 0;
void img_processing();
void get_corners();
void adaptiveThreshold(uint8_t* img_data, uint8_t* output_data, int width, int height, int block, uint8_t clip_value);
void threshold(uint8_t *img_data, uint8_t *output_data, int width, int height, int thres);
int main(void)
{
clock_init(SYSTEM_CLOCK_120M); // <20><>ʼ<EFBFBD><CABC>оƬʱ<C6AC><CAB1> <20><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>Ϊ 120MHz
debug_init(); // <20><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC>MPU ʱ<><CAB1> <20><><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>
ips114_init();
mt9v03x_init();
ips114_init();
by_gpio_init();
by_exit_init();
by_pwm_init();
cw_servo_init();
while (1) {
//while (frame_count < 20) {
@@ -138,33 +143,4 @@ int main(void)
}
}
/*
void threshold(uint8_t *img_data, uint8_t *output_data, int width, int height, int thres){
for(int y=0; y<height; y++){
for(int x=0; x<width; x++){
output_data[x+y*width] = img_data[x+y*width]>thres ? 255 : 0;
}
}
}
void adaptiveThreshold(uint8_t* img_data, uint8_t* output_data, int width, int height, int block, uint8_t clip_value){
int half_block = block / 2;
for(int y=half_block; y<height-half_block; y++){
for(int x=half_block; x<width-half_block; x++){
// <20><><EFBFBD><EFBFBD><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD>ֵ
int thres = 0;
for(int dy=-half_block; dy<=half_block; dy++){
for(int dx=-half_block; dx<=half_block; dx++){
thres += img_data[(x+dx)+(y+dy)*width];
}
}
thres = thres / (block * block) - clip_value;
// <20><><EFBFBD>ж<EFBFBD>ֵ<EFBFBD><D6B5>
output_data[x+y*width] = img_data[x+y*width]>thres ? 255 : 0;
}
}
}*/
}