資源簡介
使用STM32搭配OV7670采集圖像,并將圖像通過串口上傳到上位機,上位機接受數據并處理數據,最終顯示彩色圖像

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
using?System.IO.Ports;
using?System.IO;
namespace?image
{
????public?partial?class?Form1?:?Form
????{
????????#region?全局變量
????????int?bmp_width??=?240;???????????????????????????//定義接收數據的寬度
????????int?bmp_height?=?320;???????????????????????????//定義接受圖片的高度
????????Bitmap?bmp;?????????????????????????????????????//定義一個bmp變量用于顯示與儲存圖片
????????int?hang?=?0?lie?=?0;??????????????????????????//用于寫入圖像時的行列指針
????????//串口發送回的數據以8為為依據將rgb565拆分成2個字節發送故需要以下變量
????????bool?isheight?=?true;???????????????????????????//判斷是否為高位的標志位true表示當前數據為高位數據
????????int?heightdate?=?0;?????????????????????????????//用于存儲高8位的儲存單元
????????bool?pic_MoveFlag?=?false;??????????????????????//pic移動的標志位
????????int?pic_xPos?=?0;???????????????????????????????//鼠標移動的偏移量
????????int?pic_yPos?=?0;
????????string?SelectPath?=?““;
????????int?orderID?=?1;
????????#endregion
????????///?
????????///?窗口初始化
????????///?
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?ShowDebug(string?str)
????????{
????????????try
????????????{
????????????????int?MaxLength?=?14;
????????????????int?lines?=?(str.Length?/?MaxLength)?+?1;
????????????????textBox1.Text?+=?DateTime.Now.ToString(orderID.ToString(“000“)?+?“·[yy-MM-dd?HH:mm:ss]:\r\n“);
????????????????orderID++;
????????????????for?(int?i?=?0;?i?????????????????{
????????????????????if?(i?==?lines?-?1)
????????????????????{
????????????????????????textBox1.Text?+=?“-?“
????????????????????????????+?str.Substring(i?*?MaxLength?str.Length?%?MaxLength)
????????????????????????????+?“\r\n“;
????????????????????}
????????????????????else
????????????????????{
????????????????????????textBox1.Text?+=?“-?“
????????????????????????????+?str.Substring(i?*?MaxLength?MaxLength)?+?“\r\n“;
????????????????????}
????????????????}
????????????????textBox1.Text?+=?“\r\n\r\n“;
????????????}
????????????catch?{?}
????????}
????????///?
????????///?窗口UI初始化調用
????????///?
????????///?
????????///?
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????button1_Click(null?null);??????????????????//更新串口號???
????????????comboBox2.SelectedIndex?=?4;????????????????//選中默認波特率
????????????ShowDebug(“系統開始運行。“);
????????????bmp?=?new?Bitmap(bmp_height?bmp_width);
????????}
????????///?
????????///?更新按鍵按下可自動查找可用串口
????????///?
????????///?
????????///?
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????comboBox1.Items.Clear();
????????????for?(int?i?=?0;?i?30;?i++)?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????187??2018-07-03?23:00??(2017.09.16)串口圖像上位機\image\App.config
?????文件?????158208??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\bin\Debug\image.exe
?????文件????????187??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\bin\Debug\image.exe.config
?????文件??????46592??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\bin\Debug\image.pdb
?????文件??????23168??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\bin\Debug\image.vshost.exe
?????文件????????187??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\bin\Debug\image.vshost.exe.config
?????文件????????490??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\bin\Debug\image.vshost.exe.manifest
?????文件??????67646??2018-07-03?23:00??(2017.09.16)串口圖像上位機\image\Demo.ico
?????文件??????17792??2018-07-03?23:00??(2017.09.16)串口圖像上位機\image\Form1.cs
?????文件??????17951??2018-07-03?23:00??(2017.09.16)串口圖像上位機\image\Form1.Designer.cs
?????文件?????107997??2018-07-03?23:00??(2017.09.16)串口圖像上位機\image\Form1.resx
?????文件???????3945??2018-07-03?23:00??(2017.09.16)串口圖像上位機\image\image.csproj
?????文件???????1609??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????7087??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件???????3068??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\obj\Debug\image.csproj.FileListAbsolute.txt
?????文件????????977??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\obj\Debug\image.csproj.GenerateResource.Cache
?????文件???????2211??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\obj\Debug\image.csprojResolveAssemblyReference.cache
?????文件?????158208??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\obj\Debug\image.exe
?????文件??????68212??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\obj\Debug\image.Form1.resources
?????文件??????46592??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\obj\Debug\image.pdb
?????文件????????180??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\obj\Debug\image.Properties.Resources.resources
?????文件??????????0??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件??????????0??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件??????????0??2018-07-03?23:16??(2017.09.16)串口圖像上位機\image\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
?????文件????????579??2018-07-03?23:00??(2017.09.16)串口圖像上位機\image\Program.cs
?????文件???????1434??2018-07-03?23:09??(2017.09.16)串口圖像上位機\image\Properties\AssemblyInfo.cs
?????文件???????2862??2018-07-03?23:09??(2017.09.16)串口圖像上位機\image\Properties\Resources.Designer.cs
?????文件???????5612??2018-07-03?23:09??(2017.09.16)串口圖像上位機\image\Properties\Resources.resx
?????文件???????1092??2018-07-03?23:09??(2017.09.16)串口圖像上位機\image\Properties\Settings.Designer.cs
?????文件????????249??2018-07-03?23:09??(2017.09.16)串口圖像上位機\image\Properties\Settings.settings
............此處省略132個文件信息
- 上一篇:360環視攝像頭魚眼四攝像頭拼接算法
- 下一篇:RD kit官方指南
評論
共有 條評論