Cov txheej txheem:

Kev Ua Duab Nrog Raspberry Pi: Txhim Kho OpenCV & Duab Sib cais Xim: 4 Kauj Ruam
Kev Ua Duab Nrog Raspberry Pi: Txhim Kho OpenCV & Duab Sib cais Xim: 4 Kauj Ruam

Video: Kev Ua Duab Nrog Raspberry Pi: Txhim Kho OpenCV & Duab Sib cais Xim: 4 Kauj Ruam

Video: Kev Ua Duab Nrog Raspberry Pi: Txhim Kho OpenCV & Duab Sib cais Xim: 4 Kauj Ruam
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Kev Ua Duab Nrog Raspberry Pi: Txhim Kho OpenCV & Duab Xim Sib cais
Kev Ua Duab Nrog Raspberry Pi: Txhim Kho OpenCV & Duab Xim Sib cais

Cov ntawv tshaj tawm no yog thawj ntawm ntau qhov kev qhia ua duab uas yuav ua raws. Peb ua tib zoo saib cov pixels uas tsim cov duab, kawm yuav ua li cas rau nruab OpenCV ntawm Raspberry Pi thiab peb tseem sau cov ntawv xeem kom ntes cov duab thiab tseem ua cov xim sib cais siv OpenCV.

Cov vis dis aus saum toj no muab rau koj ntau cov ntaub ntawv ntxiv uas yuav pab koj kom nkag siab zoo dua ntawm kev ua duab thiab tag nrho cov txheej txheem teeb tsa. Kuv pom zoo kom koj saib thawj zaug raws li cov ntawv sau no yuav tsuas yog npog qhov tsis tseem ceeb uas yuav tsum tau rov tsim dua koj tus kheej.

Kauj Ruam 1: Npaj Raspberry Pi

Npaj Raspberry Pi
Npaj Raspberry Pi

Txog qhov haujlwm no, Kuv yuav siv Raspberry Pi 3B+ tab sis koj tuaj yeem siv lwm yam kev hloov pauv uas koj yuav muaj. Ua ntej peb tuaj yeem khau raj lub rooj tsavxwm, peb yuav tsum nyem cov duab rau Raspberry Pi. Thov siv Desktop version rau qhov no raws li peb xav tau cov khoom siv GUI. Koj tuaj yeem nyem cov duab siv Etcher. Tom qab ntawd peb yuav tsum txiav txim siab txog ob yam hauv qab no:

Kev Nkag Mus Rau Network:

Koj tuaj yeem txuas rau hauv ethernet cable yog tias koj xav siv qhov txuas txuas, tab sis kuv yuav siv lub onboard WiFi.

RPi Tswj:

Peb kuj yuav tsum tau teeb tsa qee cov software thiab sau qee cov ntawv txhawm rau ua haujlwm no. Txoj hauv kev yooj yim tshaj plaws los ua qhov no yog los ntawm kev txuas cov zaub, keyboard thiab nas rau lub rooj tsavxwm. Kuv nyiam siv SSH thiab kev nkag mus rau tej thaj chaw deb ntawd yog qhov kuv yuav siv rau cov vis dis aus.

Yog tias koj xav tswj hwm Raspberry PI nyob deb, tom qab ntawv thov nyeem kab ntawv hauv qab no uas npog txhua yam koj xav paub txog kev ua li ntawd.

www.instructables.com/id/Remotely-Accessing-the-Raspberry-Pi-SSH-Dekstop-FT/

Tsuas yog ntxig daim npav microSD rau hauv koj lub rooj tsavxwm thiab tom qab ntawd qhib lub zog. Thawj qhov peb yuav tsum tau ua yog qhib lub koob yees duab. Koj tuaj yeem ua qhov no los ntawm qhib lub davhlau ya nyob twg thiab ntaus hauv:

sudo raspi-teeb tsa

Tom qab ntawv koj mus rau ntu "Kev Xaiv Kev Sib Txuas" yam khoom, tom qab ntawd "Lub Koob Yees Duab" txhawm rau pab nws. Nws yuav nug koj kom rov pib dua, yog li hais tias yog rau qhov no thiab tom qab ntawd muab sijhawm rau pawg thawj coj saib kom rov pib dua.

Qhov ntxiv uas peb yuav tsum tau ua yog ntsuas yog lub koob yees duab ua haujlwm raug. Qhov no tuaj yeem ua tiav los ntawm kev khiav cov lus txib hauv qab no:

raspistill -o test.jpg

Cov lus txib saum toj no yuav ntes cov duab thiab khaws cia rau hauv /home /pi directory. Tom qab ntawv koj tuaj yeem qhib tus thawj tswj ntaub ntawv thiab saib qhov no kom paub meej tias txhua yam ua haujlwm zoo li nws yuav tsum tau ua.

Peb mam li hloov kho lub operating system los ntawm kev ua cov lus txib hauv qab no:

sudo apt hloov tshiab && sudo apt full -upgrade -y

Cov kauj ruam no yuav siv qee lub sijhawm nyob ntawm koj lub network sib txuas tab sis nws tau pom zoo kom ua li ntawd.

Kauj Ruam 2: Txhim Kho OpenCV

Peb yuav siv PIP uas yog pob installer rau nab nab txhawm rau txhawm rau txhim kho qee qhov qauv, yog li xyuas kom nws tau teeb tsa los ntawm kev ua cov lus txib hauv qab no:

sudo apt nruab python3-pip

Thaum qhov no ua tiav, peb yuav tsum teeb tsa qhov kev vam khom (software ntxiv) uas xav tau ua ntej peb tuaj yeem nruab OpenCV nws tus kheej. Koj yuav tsum tau ua txhua qhov ntawm cov lus txib hauv qab no thiab kuv xav pom zoo kom qhib cov ntawv no ntawm Raspberry Pi browser thiab tom qab ntawd theej/tso cov lus txib.

  • sudo apt nruab libatlas-base-dev -y
  • sudo apt nruab libjasper -dev -y
  • sudo apt nruab libqtgui4 -y
  • sudo apt nruab python3 -pyqt5 -y
  • sudo apt nruab libqt4 -test -y
  • sudo apt nruab libhdf5-dev libhdf5-serial-dev -y
  • sudo pip3 nruab opencv-contrib-python == 4.1.0.25

Qhov no yuav teeb tsa OpenCV rau peb. Ua ntej peb tuaj yeem siv nws, peb yuav tsum teeb tsa lub picamera module kom peb tuaj yeem siv Raspberry Pi lub koob yees duab. Qhov no tuaj yeem ua tiav los ntawm kev khiav cov lus txib hauv qab no:

pip3 nruab picamera [array]

Kauj Ruam 3: Kuaj OpenCV

Kuaj OpenCV
Kuaj OpenCV
Kuaj OpenCV
Kuaj OpenCV

Tam sim no peb yuav sau peb thawj tsab ntawv kom ntseeg tau tias txhua yam raug teeb tsa kom raug. Nws yuav yooj yim ntes cov duab thiab tom qab ntawd tso nws ntawm qhov screen. Khiav cov lus txib hauv qab no los tsim thiab qhib cov ntawv sau tshiab:

sudo nano test-opencv.py

Kuv pom zoo kom luam cov ntawv los ntawm cov ntawv hauv qab no thiab tom qab ntawd muab nws tso rau hauv cov ntawv tshiab uas koj tau tsim. Lossis koj tuaj yeem yooj yim ntaus nws tag nrho.

github.com/bnbe-club/opencv-demo-diy-27

Thaum qhov ntawd ua tiav, tsuas yog khaws cov ntawv los ntawm kev ntaus "CTRL+X", tom qab ntawd Y, thiab tom qab ntawd nkag mus. Tsab ntawv tuaj yeem ua haujlwm los ntawm kev ntaus hauv cov lus txib hauv qab no:

python3 test-opencv.py

Koj yuav tsum muaj peev xwm pom cov duab ntawm lub vijtsam thiab thov saib daim vis dis aus txhawm rau txheeb xyuas, yog tias xav tau. Tsis tas li, thov nco ntsoov nias ib qho tseem ceeb ntawm koj cov keyboard kom tawm ntawm tsab ntawv. Nws yuav tsis tawm thaum koj kaw lub qhov rai.

Kauj Ruam 4: Sib cais Xim

Sib cais xim
Sib cais xim
Sib cais xim
Sib cais xim

Tam sim no txhua yam ua haujlwm raws li nws yuav tsum tau, peb tuaj yeem tsim tsab ntawv tshiab kom tau txais cov duab thiab tom qab ntawd tso saib cov xim ib tus zuj zus. Khiav cov lus txib hauv qab no los tsim thiab qhib cov ntawv sau tshiab:

sudo nano duab-components.py

Kuv pom zoo kom luam cov ntawv los ntawm cov ntawv hauv qab no thiab tom qab ntawd muab nws tso rau hauv cov ntawv tshiab uas koj tau tsim. Lossis koj tuaj yeem yooj yim ntaus nws tag nrho.

github.com/bnbe-club/opencv-demo-diy-27

Thaum qhov ntawd ua tiav, tsuas yog khaws cov ntawv los ntawm kev ntaus "CTRL+X", tom qab ntawd Y, thiab tom qab ntawd nkag mus. Tsab ntawv tuaj yeem ua los ntawm kev ntaus hauv cov lus txib hauv qab no: python3 image-components.py. Koj yuav tsum muaj peev xwm pom cov duab ntes nrog rau cov xim xiav, ntsuab thiab liab ntawm lub vijtsam. Thov saib cov vis dis aus kom paub tseeb, yog xav tau. Tsis tas li, thov nco ntsoov nias ib qho tseem ceeb ntawm koj cov keyboard kom tawm ntawm tsab ntawv. Nws yuav tsis tawm thaum koj kaw lub qhov rai.

Yog li ntawd nws yooj yim npaum li cas los pib nrog OpenCV, siv Raspberry Pi. Peb yuav txuas ntxiv tsim qee cov ntawv sau ntxiv uas yuav qhia koj qee yam tshwj xeeb. Cov yeeb yaj kiab OpenCV thiab tshaj tawm zoo li cov no yuav mus nyob rau hnub Sunday tab sis thov ua tsaug rau peb tshooj YouTube channel kom tau txais kev ceeb toom.

YouTube Channel:

Ua tsaug rau koj nyeem!

Pom zoo: