基于激光投射虛擬鍵盤鐳射參考_第1頁
基于激光投射虛擬鍵盤鐳射參考_第2頁
基于激光投射虛擬鍵盤鐳射參考_第3頁
基于激光投射虛擬鍵盤鐳射參考_第4頁
基于激光投射虛擬鍵盤鐳射參考_第5頁
已閱讀5頁,還剩42頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

誠信聲明本人聲明1、本人所呈交的誠信聲明本人聲明1、本人所呈交的畢業(yè)設(shè)計(論文)是在老師指導(dǎo)下進(jìn)行的研工作及取得的研究成果2、據(jù)查證,除了文中特別加以標(biāo)注和致謝的地方外,畢業(yè)設(shè)(論文)中不包含其他人已經(jīng)公開發(fā)表過的研究成果,也不包含為得其他教育機構(gòu)的學(xué)位而使用過的材料3我承諾本人提交的畢業(yè)設(shè)(論文中的所有內(nèi)容均真實可信作者簽名日期年月日鐳射鍵盤、mini全向輪移動小車等等),敬請關(guān)注!鐳射鍵盤、mini全向輪移動小車等等),敬請關(guān)注!關(guān)注回復(fù)關(guān)鍵詞【自動跟隨】:獲取自動跟隨機器人的資料教程技術(shù)交流學(xué)習(xí)請加微信備注【進(jìn)群】拉你進(jìn)交流群目錄摘 第目錄摘 第1章緒 OpenCV背景和現(xiàn) OpenCV發(fā)展?fàn)?OpenCV應(yīng)用簡 Studio簡 CameraCalibrationToolbox簡 硬件簡 紅外激光簡 攝像頭簡 1.4課題設(shè)計要 23總體設(shè)計方案構(gòu) 基本原理介 軟件介 硬件系統(tǒng)設(shè) 攝像 紅外激 鍵盤投影激 電源轉(zhuǎn)換電 第4章軟件設(shè) 開發(fā)環(huán)境介 4.1.2OpenCV視覺庫的使 攝像頭的標(biāo) 上位機程 程序流程圖設(shè) 第5章整機調(diào) 系統(tǒng)總 按鍵測 按鍵容錯測 總致 參考文參考文 附 TheThevirtualkeyboardbasedonlaserprojectionAbstract:ThelaserprojectionvirtualkeyboarddesignedinthisthesisisbasedonOpenCVcombinewithimagecamera,980nmlinearlaser,980nminfraredfilterandKeyboardprojectionlaser,theimagecameradetectionusedwith980nminfraredfilteriscausedbyshieldingfingertomake980nmlinearlaserdiffusereflectionthelight.Bydetectingandlocatingthecenterpositionofthelightoutlinetodiscernanddetectthepositionoffingerandthenmaptokeyboardpositiontoachieverelativekeyboardkeyevents.WithOpenCVvisionlibrary,itisfasttofindthefingeroutlinewhichisgetbyimagecamera,thepositionoffingerlocationandrevisetheimagesurfacedistortionwhichiscausedbyimagecamera.ByusingOpenCV,thebottomhardwaredrivecodewrittencanbereduced,andinvokebuilt-infunctioncandirectlyfacetohardwarewritecodetofastenthedifficultandspeedofprogramdevelopment.Byexperimentandtest,thisvirtualkeyboardcancorrectlyandaccuratelylocateanddetectthefingerposition,ontheotherhand,thiskeyboardalsohavefault-toleranttreatment,andfinallyrealizethefunctionofkeyinput.KeyWords:OpenCV;C++;imageprocessing;VisualStudio2010;laser11.1OpenCVOpenCV1.1.1OpenCV發(fā)展?fàn)頞penCVOpenSourceComputerVisionLibrary19991.1.2OpenCV應(yīng)用簡OpenCV可以應(yīng)用于人機交互領(lǐng)域可以通過識別人手在空間的位置以及手勢從而可1.1.3VisualStudio簡Visual 在第一代VisualStudio是1997年推出的,它基本上已經(jīng)包含了絕大部分的微軟的自帶不斷的出現(xiàn)更新版而使得成為了最受歡迎的編譯環(huán)境,用它所編輯的代碼使用于Windows平臺包括MicrosoftWindowsWindowsMobileWindowsCE、.NETFramework、.NETCompactFrameworkMicrosoftSilverlight及WindowsPhone,同時1.2CameraCalibrationToolboxMATLAB1.2CameraCalibrationToolboxMATLABMathWorks公司出品的商業(yè)數(shù)學(xué)軟件,數(shù)據(jù)可視化、用于算法開Simulink兩大部分,在世界編程語言排行榜2014年3Matlab排名第16位并且使MatlabJAVA,C,C++FORTRANMatlab軟件里直接Matlab中直接調(diào)用,在自帶的庫函數(shù)中包含了基本上所有的工Matlab中除了擁有基本的數(shù)百個內(nèi)部函數(shù)之外還包含了三十幾種不同用途的工MATLABMatlab里的一個工具箱主要用于攝像機內(nèi)部參數(shù)標(biāo)定,利用這個工具箱就可以得1.31.3.1紅外激光簡LASER,意思是“受激輻射的光放大”紅外激光也是激光的一種只是它的發(fā)光波長是760nm~1mm是波長比紅光長的非可1.3.2攝像頭簡CCD(電荷耦合器件)1.4以及了解OpenCV視覺庫的使用和移植。2980nm2980nm2.12.22.2OpenCVC33.133.1頭的鏡頭的視角是90°的所以檢測到的面積很小這樣就會導(dǎo)致攝像頭固定的高度會很150h2而的視角是90°同樣為了檢測所有的鍵盤投影范圍所需要安裝的高度需是CameraCamera1h1Camera1的視角小于Camera2所有必需得提高安裝高度才能檢測到同樣的面積范圍,為了縮小整個硬件系統(tǒng)故選擇了視角為150°鏡頭的攝像頭。2所示左邊的鏡頭是市面上攝像頭的鏡頭在鏡頭后面加了一層紅外光濾光片這個濾光片980nm2所示左邊的鏡頭是市面上攝像頭的鏡頭在鏡頭后面加了一層紅外光濾光片這個濾光片980nm980nm的980nm980nm以下的光線而3.2未濾可見光效濾除可見光效3.33.230mW980nm30mWB類型激光只有不要 120°只有調(diào)節(jié)好投影鍵盤的位置一字激光可以完全覆蓋到所有的鍵盤范圍3.3鍵盤投影激123432 120°只有調(diào)節(jié)好投影鍵盤的位置一字激光可以完全覆蓋到所有的鍵盤范圍3.3鍵盤投影激1234321213253.53.6PCB5V供電而鍵盤投影激光是要3.3V供電使用需要一個3.3V5V3.3V144.144.1StudioWindowsOpenCV4.24.24.24.2150所拍攝出的圖片是會有失真的所以在實際操作中必須要把失真的圖片校正不然在后面MatlabCameraCalibrationoolbox。MatlabCameraCalibrationToolboxGUI界面(4.3-1)4.3CameraCalibrationToolbox4.44.5單張標(biāo)定照片標(biāo)定4.6標(biāo)定誤差分析4.6標(biāo)定誤差分析標(biāo)定圖片在4.8標(biāo)定鏡頭畸變向量圖4.8標(biāo)定鏡頭畸變向量圖4.9標(biāo)定輸出參數(shù)4.10xmlMatlab校正校正4.11校正后的圖片比較4.2-校正校正4.11校正后的圖片比較4.2-4.3上位機程使用VisualStudio通過OpenCV原始圖 cvThreshold對單通道圖片數(shù)據(jù)應(yīng)用固定閾值操作4.134.13得到二值化圖像后接下來要做的就是查找所有興趣點的輪廓,OpenCV里的findContours是輪廓檢測函數(shù)之一這個函數(shù)可以使用多邊形來近似表示一個輪廓其次,函數(shù)對該多邊形曲線做適當(dāng)近似,如果要畫出查找到的輪廓的話就可以配合使用drawContoursboundingRect,還可以得到輪廓的外包絡(luò)矩形。定位包絡(luò)4.14查找輪廓后的圖片4.15鍵盤映射后的圖片4.15鍵盤映射后的圖片4.1655.155.1系統(tǒng)總5.1整機總成5.2按鍵5.2按鍵測比較豐富所以該系統(tǒng)在檢測的時候可能會受到影響,因為本系統(tǒng)中使用的是980nm濾光片而自然界的光也包含了這一波長的光以及這波長附件的光而濾光片不能完完全5.2按鍵測試5.35.3上位機按鍵檢測5.3按鍵容錯測5.4多鍵按下容錯測試5.4多鍵按下容錯測試5.5多鍵按下軟件容錯測試5.6兩鍵按下容錯測試U5.6兩鍵按下容錯測試U5.7兩鍵按下軟件容錯測試PCMatlab、AltiumDesigner等設(shè)計工具完成設(shè)計。OpenCVVisualStudio設(shè)計比較系統(tǒng)的東西,以前VC++6.0VisualStudioOpenCVOpenCV視孫鑫VC++深入詳解[M].電子工業(yè)出版社,BradskiG.OpenCV(中文版)[M].清華大學(xué)出版社孫鑫VC++深入詳解[M].電子工業(yè)出版社,BradskiG.OpenCV(中文版)[M].清華大學(xué)出版社張德豐MATLAB數(shù)字圖像處理[M].機械工業(yè)出版社(美)StanleyB.LippmanBarbaraE.Moo,JoséeLaJoie.CPrimer[M].人民郵電出版社嚴(yán)蔚敏.C語言版[M].清華大學(xué)出版社[6]HCormenT,ELeisersonC.算法導(dǎo)論[M].機械工業(yè)出版社出版(第二版)〔加〕RobertLaganiereOpenCV2計算機視覺編程手冊[M].科學(xué)出版社陳勝勇,劉盛.OpenCV的計算機視覺技術(shù)實現(xiàn)[M].科學(xué)出版社(美)StanleyB.LippmanBarbaraE.Moo,JoséeLaJoie.CPrimer[M].人民郵電出版社[10].OpenCVTutorialsRelease[CP/OL].[2010-3-2].[11].OpenCV2.4CheatSheet(C++)[CP/OL].[2010-3-4].[12].OpenCVReferenceManualRelease[CP/OL].[2010-4-6].[13].OpenCVManagerManualRelease[CP/OL].[2010-5-12].[14].OpenCVUserGuideRelease[CP/OL].[2010-5-24].[17]ZhangZ.AFlexibleNewTechniqueforCameraCalibration[EB/OL].[2010-6-4].#include<cv.h>#include"opencv2/highgui/highgui.hpp"#include<iostream>#include<stdio.h>#include<stdlib.h>usingnamespacecv;usingnamespaceMatsrc;Matsrc_gray;intthresh=intmax_thresh=255;RNGrng(12345);char{{,,,,, ,,,,,,,,, ,,,,,,#include<cv.h>#include"opencv2/highgui/highgui.hpp"#include<iostream>#include<stdio.h>#include<stdlib.h>usingnamespacecv;usingnamespaceMatsrc;Matsrc_gray;intthresh=intmax_thresh=255;RNGrng(12345);char{{,,,,, ,,,,,,,,, ,,,,,,,,,,,{VK_CAPITAL,VK_TAB,,,,,,,,,,,VK_RETURN,,,,,,,,, ,, ,{VK_CONTROL,VK_MENU,VK_LWINVK_SPACE,VK_SPACE,VK_SPACE,,, ,VK_SPACE,VK_SPACE,,,,VK_DELETEUINTNEW_FLAG_ROW4=0;UCHARRead_key_count=///voidthresh_callback(int,void*);voidGet_Form(int,void*);intmain(int///voidthresh_callback(int,void*);voidGet_Form(int,void*);intmain(intargc,char**argv{CvCapture*capture=cvCaptureFromCAM(0)return-intpressKey;IplImage*frame=NULL;IplImage*Undistor_Image=IplImage*CvMat*intrinsic=(CvMat*)cvLoad("Intrinsics.xml");intflag={frame=if{///載入原圖像,3Undistor_Image=cvCloneImage(frame);src=img;g_pGrayImage= cvCvtColor(frame,g_pGrayImage,CV_BGR2GRAY);IPL_DEPTH_8U,1);=/////blur(/////blur(src_gray,src_gray,Size(2,2)///char*source_window=imshow(source_window,src);thresh_callback);"thresh_callback(0,0);}{std::cout<< flag=1;}pressKey=cvWaitKey(50);{}elseif(pressKey=={}}}elseif(pressKey=={}}return0;}void{Read_key_count=++Read_key_count;Read_key_count=Read_key_count%2;Matbin_mimage_output(bin_mimage);IplImage*key_draw=cvLoadImage("keyNull.bmp",-Matdraw_key_point(key_draw);廓是一個Pointvector釋intPoint_count=unsignedcharRow_count=0;intKey_Press_Posion=NULL;intsubkeypress;intlinewhith=-//findContours/////contourspoint類型的vector//hiararchycontours[i]對應(yīng)4個hierarchyhierarchy[i][0]~hierarchy[i][3CV_RETR_TREE,CV_CHAIN_APPROX_SIMPLE,Point(10,10)///+vector<vector<Point>>contours_poly(bin_mimage_contours.size()CV_RETR_TREE,CV_CHAIN_APPROX_SIMPLE,Point(10,10)///+vector<vector<Point>>contours_poly(bin_mimage_contours.size()for(inti=0;i<bin_mimage_contours.size();i++{approxPolyDP(Mat(bin_mimage_contours[i]),contours_poly[i],3,trueboundRect[i]=boundingRect(Mat(contours_poly[i])minEnclosingCircle(contours_poly[i],center[i],radius[i]}///+Matdrawing=Mat::zeros(bin_mimage_output.size(),CV_8UC3for(inti=0;i<bin_mimage_contours.size();i++{if(((boundRect[i].br().x -boundRect[i].tl().x)>10)||((boundRect[i].br().yboundRect[i].tl().y)>10)){stringintNum_Count=- rng.uniform(0,255)drawContours(drawing,contours_poly,i,color,1,8,0,Point()rectangle(drawing,boundRect[i].tl(),boundRect[i].br(),color,0,Point()rectangle(drawing,boundRect[i].tl(),boundRect[i].br(),color,2,8,0//畫矩形,tl矩形左上角,br==Row_start_point.y= +boundRect[i].tl().y)/=line(drawing,Row_start_point,==Col_start_point.x=+boundRect[i].tl().x)/=line(drawing,Col_start_point,key_circle_center.x=Col_start_point.x;PointRow_Start_axis=key_circle_center;Row_End_axis=key_circle_center;Row_Start_axis.x=Row_Start_axis.x-10;Row_End_axis.x=Row_End_axis.x+10;Col_Start_axis=key_circle_center;Col_End_axis=key_circle_center;Col_Start_axis.y=Col_Start_axis.y-10;Col_End_axis.y=Col_End_axis.y+Word_point.x=Col_start_point.x;Word_point.y=if((Word_point.y<=377)&&(Word_point.y>{Row_count=Row_count|}elseif((Word_point.y<=332)&&(Word_point.y>{Row_count=Row_count|}elseif((Word_point.y<=286)&&(Word_point.y>{Row_count=Row_count}elseif((Word_point.y<=286)&&(Word_point.y>{Row_count=Row_count|}elseif((Word_point.y<=249)&&(Word_point.y>{Row_count=Row_count|}elseif((Word_point.y<=211)&&(Word_point.y>{Row_count=Row_count|}if{if(Row_count&{><(Word_point.y<=211)&&(Word_point.y>{if(Key_Press_Posion==0){rectangle(draw_key_point,Point(15+*38),265),Point(53+(Key_Press_Posion*38),299),CV_RGB(255,255,255),linewhith,8,0);}elseif((Key_Press_Posion>=1)&&(Key_Press_Posion<={rectangle(draw_key_point,Point(19+*38),265),Point(53+(Key_Press_Posion*38),299),CV_RGB(255,255,255),linewhith,8,0);}elseif((Key_Press_Posion>=10)&&(Key_Press_Posion{+*+*CV_RGB(255,255,255),linewhith,8,0}{CV_RGB(255,255,255),linewhith,8,0);}{}}if(Row_count&{if((Word_point.x>589)&&(Word_point.x<{rectangle(draw_key_point,Point(15}{}}if(Row_count&{if((Word_point.x>589)&&(Word_point.x<{rectangle(draw_key_point,Point(15,227),Point(66CV_RGB(255,255,255),linewhith,8,0format("%C",Keyboard_String_table[1][0]),Point(100,100),FONT_HERSHEY_SIMPLEX,1.5,CV_RGB(0,0,0),0);}elseif((Word_point.x>40)&&(Word_point.x<590)&&(Word_point.y<=249)&&(Word_point.y>211)){Key_Press_Posion=15-(Word_point.xif(Key_Press_Posion=={+*+*CV_RGB(255,255,255),linewhith,8,0}{+*+*CV_RGB(255,255,255),linewhith,8,0}putText(drawing,format("%C",Keyboard_String_table[3][14-CV_RGB(255,255,255),}{}}if(Row_count{}}if(Row_count&{if(((Word_point.x>576)&&(Word_point.x<620))||((Word_point.x>44)&&(Word_point.x<105))&&(Word_point.y<=286)&&(Word_point.y>249)){if(((Word_point.x>576)&&(Word_point.x<{rectangle(draw_key_point,Point(34,189),Point(85CV_RGB(255,255,255),linewhith,8,0format("%C",Keyboard_String_table[1][0]),Point(100,100),FONT_HERSHEY_SIMPLEX,1.5,CV_RGB(255,255,255),0);}elseif((Word_point.x>45)&&(Word_point.x<{CV_RGB(255,255,255),linewhith,8,0);1.5,CV_RGB(255,255,255),0);}{}}elseif((Word_point.x>45)&&(Word_point.x<577)&&(Word_point.y<=286)&&(Word_point.y>249)){Key_Press_Posion=14-(Word_point.xif(Key_Press_Posion>0&&Key_Press_Posion<12{rectangle(draw_key_point,Point(51+*38),189),Point(85+(Key_Press_Posion*38),223),CV_RGB(255,255,255),linewhith,8,0);}-CV_RGB(255,255,255),}{}}if(Row_count&-CV_RGB(255,255,255),}{}}if(Row_count&{if(((Word_point.x>552)&&(Word_point.x<600))||((Word_point.x>65)&&(Word_point.x<110))&&(Word_point.y<=332)&&(Word_point.y>286)){if(((Word_point.x>552)&&(Word_point.x<{CV_RGB(255,255,255),linewhith,8,0format("%C",Keyboard_String_table[1][0]),Point(100,100),FONT_HERSHEY_SIMPLEX,1.5,CV_RGB(255,255,255),0);}elseif((Word_point.x>65)&&(Word_point.x<{CV_RGB(255,255,255),linewhith,8,0);1.5,CV_RGB(255,255,255),0);}{}}elseif((Word_point.x>111)&&(Word_point.x<553)&&(Word_point.y<=332)&&(Word_point.y>286)){Key_Press_Posion=10-(Word_point.x-rectangle(draw_key_point,Point(70+Key_Press_Posion*38,151),Point(104+Key_Press_Posion*38,185),CV_RGB(255,255,255),linewhith,8,0);putText(drawing,format("%C",Keyboard_String_table[1][10-CV_RGB(255,255,255),}{}}if(Row_countCV_RGB(255,255,255),}{}}if(Row_count&{NEW_FLAG_ROW4=if(((Word_point.x>551)&&(Word_point.x<586))||((Word_point.x>77)&&(Word_point.x<116))&&(Word_point.y<=377)&&(Word_point.y>332)){if(((Word_point.x>551)&&(Word_point.x<586))&&(Word_point.y<=377)&&(Word_point.y>332)){CV_RGB(255,255,255),linewhith,8,0NEW_FLAG_ROW4=NEW_FLAG_ROW4|format("%C",Keyboard_String_table[0][0]),Point(100,100),FONT_HERSHEY_SIMPLEX,1.5,CV_RGB(255,255,255),0);}elseif((Word_point.x>77)&&(Word_point.x<116)&&(Word_point.y<=377)&&(Word_point.y>332)){Point(541,147),CV_RGB(255,255,255),linewhith,8,0NEW_FLAG_ROW4=NEW_FLAG_ROW4|1.5,CV_RGB(255,255,255),0);}{}}elseif((Word_point.x>117)&&(Word_point.x<552)&&(Word_point.y<=377)&&(Word_point.y>332)){Key_Press_Posion=10-(Word_point.x-rectangle(draw_key_point,Point(89+Key_Press_Posion38,113),Point(123+Key_Press_Posion*38,147),CV_RGB(255,255,255),linewhith,8,0NEW_FLAG_ROW4=NEW_FLAG_ROW4|(0x00001putText(drawing,format("%C",Keyboard_String_table[0][10-38,113),Point(123+Key_Press_Posion*38,147),CV_RGB(255,255,255),linewhith,8,0NEW_FLAG_ROW4=NEW_FLAG_ROW4|(0x00001putText(drawing,format("%C",Keyboard_String_table[0][10-CV_RGB(255,255,255),}{OLD_FLAG_ROW4=}=&}dis_string=format("x=%d,y=%d",}if(NEW_FLAG_ROW4&&(OLD_FLAG_ROW4!=0xFFFFF)&&(1{if{ = {if((OLD_FLAG_ROW4>>LOOP_COUNT)&{}}}OLD_FLAG_ROW4=}}{NEW_FLAG_ROW4=}}stringdis_point_count=format("Pointcount:%dRow:%d",Point_count,Row_count);putText(drawing,dis_point_count,}}{NEW_FLAG_ROW4=}}stringdis_point_count=format("Pointcount:%dRow:%d",Point_count,Row_count);putText(drawing,dis_point_count,Point(20,30),FONT_HERSHEY_SIMPLEX,CV_RGB(255,0,0),imshow("BinaryWindows_Contours",drawing);imshow("Keyboard", draw_key_point);}voidthresh_callback(int,void*{Matthreshold_output;///Thresholdthreshold(src_gray,threshold_output,thresh,255,THRESH_BINARY/////contourspoint類型的vector//hiararchycontours[i]對應(yīng)4個hierarchyhierarchy[/////contourspoint類型的vector//hiararchycontours[i]對應(yīng)4個hierarchyhierarchy[i][0]~hierarchy[i][3///+vector<vector<Point>>contours_poly(contours.size()集vector<Rect>boundRect(contours.size()vector<Point2f>center(contours.size()vector<float>radius(contours.size()for(inti=0;i<contours.size();i++{approxPolyDP(Mat(contours[i]),contours_poly[i],3,trueboundRect[i]=boundingRect(Mat(contours_poly[i])minEnclosingCircle(contours_poly[i],center[i],radius[i]}///++Matdrawing=Mat::zeros(threshold_output.size(),CV_8UC3);for(inti=

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論