能夠實現將ov7725的圖像上傳到上位機,上位機使用原子帶的就行,速度比較慢
單片機源程序如下:
- #include "stm32f10x.h"
- #include "./ov7725/ov7725.h"
- #include "./lcd/ili9341_lcd.h"
- #include "./usart/usart.h"
- #include "./systick/SysTick.h"
- extern uint8_t Ov7725_vsync;
- uint64_t Task_Delay = 20000;
- extern OV7725_MODE_PARAM cam_mode;
- int main(void)
- {
-
- // float frame_count = 0;
- uint8_t retry = 0;
- // uint16_t x,y;
- /* 液晶初始化 */
- // ILI9341_Init();
- // ILI9341_GramScan ( 3 );
-
- // LCD_SetFont(&Font8x16);
- // LCD_SetColors(WHITE,BLACK);
- // ILI9341_Clear(0,0,LCD_X_LENGTH,LCD_Y_LENGTH); /* 清屏,顯示全黑 */
-
- /********顯示字符串示例*******/
- // ILI9341_DispStringLine_EN(LINE(0),"BH OV7725 Test Demo");
- USART_Config();
- SysTick_Init();
- /* ov7725 gpio 初始化 */
- OV7725_GPIO_Config();
-
- /* ov7725 寄存器默認配置初始化 */
- while(OV7725_Init() != SUCCESS)
- {
- retry++;
- if(retry>5)
- {
- // printf("\r\n沒有檢測到OV7725攝像頭\r\n");
- // ILI9341_DispStringLine_EN(LINE(2),"No OV7725 module detected!");
- while(1);
- }
- }
- /*根據攝像頭參數組配置模式*/
- OV7725_Special_Effect(cam_mode.effect);
- /*光照模式*/
- OV7725_Light_Mode(cam_mode.light_mode);
- /*飽和度*/
- OV7725_Color_Saturation(cam_mode.saturation);
- /*光照度*/
- OV7725_Brightness(cam_mode.brightness);
- /*對比度*/
- OV7725_Contrast(cam_mode.contrast);
- /*特殊效果*/
- OV7725_Special_Effect(cam_mode.effect);
-
- /*設置圖像采樣及模式大小*/
- OV7725_Window_Set(cam_mode.cam_sx,
- cam_mode.cam_sy,
- cam_mode.cam_width,
- cam_mode.cam_height,
- cam_mode.QVGA_VGA);
- /* 設置液晶掃描模式 */
- // ILI9341_GramScan( cam_mode.lcd_scan );
-
-
-
- // ILI9341_DispStringLine_EN(LINE(2),"OV7725 initialize success!");
-
- Ov7725_vsync = 0;
-
- while(1)
- {
- /*接收到新圖像進行顯示*/
- if( Ov7725_vsync == 2 )
- {
- // frame_count++;
- FIFO_PREPARE; /*FIFO準備*/
- /*60秒采集一幀圖像通過串口1發送出去*/
- if(Task_Delay == 0)
- {
- while(SUCCESS != ImagCatch(cam_mode.lcd_sx,
- cam_mode.lcd_sy,
- cam_mode.cam_width,
- cam_mode.cam_height)); /*采集并顯示,等待串口1圖像數據發送完成,*/
- Task_Delay = 60000;
- }
- Ov7725_vsync = 0;
- }
- }
- }
- /*每隔一段時間計算一次幀率*/
- // if(Task_Delay == 0)
- // {
- // printf("\r\nframe_ate = %.2f fps\r\n",frame_count/10); //計算幀率
- // frame_count = 0; //幀數清零
- // Task_Delay = 10000; //10秒定時中斷
- // }
復制代碼
所有資料51hei提供下載:
基于OV7725的stm32實時圖像采集工程.7z
(210.91 KB, 下載次數: 115)
2019-4-10 18:28 上傳
點擊文件名下載附件
|