Cov txheej txheem:
- Kauj Ruam 1: Cov Ntaub Ntawv Header
- Kauj ruam 2: Kev ntes cov yees duab
- Kauj Ruam 3: Txheeb Tus Ncej thiab Txiav Xim
- Kauj Ruam 4: Ntxuav thiab rho tawm
- Kauj Ruam 5: Thaum kawg Tso Tawm
- Kauj ruam 6: Demo
Video: Yooj Yim Xim-Tshawb Pom Siv OpenCV: 6 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Nyob zoo! Hnub no kuv yuav qhia txoj hauv kev yooj yim txhawm rau txheeb xyuas cov xim los ntawm cov vis dis aus siv OpenCV thiab nab hab sej.
Yeej kuv yuav cia li sim cov xim uas xav tau tam sim no hauv kab tom qab lossis tsis yog thiab siv OpenCV cov qauv kuv yuav npog thaj tsam ntawd thiab ib txhij nthuav tawm cov thav duab.
Kauj Ruam 1: Cov Ntaub Ntawv Header
Tam sim no ntawm no kuv tau siv ob daim ntawv header uas yog cv2 thiab NumPy. Yeej cv2 yog OpenCV lub tsev qiv ntawv uas thauj tag nrho c ++ cov ntaub ntawv uas tseem ceeb thaum siv cov lus txib hauv cov lej (nws muaj tag nrho cov lus txhais).
Thiab Numpy yog lub tsev qiv ntawv nab nab uas yog qhov tseem ceeb rau khaws cia ntau qhov ntau. Peb yuav siv los khaws peb cov xim sib xyaw ua ke.
Thiab tus lej raws li np ib txwm pab peb cov lej kom luv me ntsis los ntawm kev siv np txhua lub sijhawm tsis txhob siv tus lej.
Kauj ruam 2: Kev ntes cov yees duab
Nov yog qhov yooj yim zoo nkauj thaum siv nab hab sej. Ntawm no peb tsuas yog xav tau qhib lub kaw video kom nws tuaj yeem pib kaw cov ntas.
Tam sim no tus nqi sab hauv VideoCapture qhia lub koob yees duab, hauv kuv cov ntaub ntawv lub koob yees duab txuas nrog kuv lub laptop, yog li 0.
Koj tuaj yeem mus zoo ib yam rau 1 rau lub koob yees duab thib ob thiab ntxiv rau. VideoCapture tsim lub hom phiaj rau nws.
Kauj Ruam 3: Txheeb Tus Ncej thiab Txiav Xim
Tam sim no ntawm no peb yuav tsum tau ua ib yam dab tsi kom peb tuaj yeem ntes lub thav duab ntawm cov vis dis aus uas yuav pab peb rho cov duab thiab peb tuaj yeem ua haujlwm raws li qhov xav tau.
"thaum" voj yuav pab peb khiav lub voj rau peb lub sijhawm xav tau. Tam sim no "_, thav duab = cap.read ()" tau siv los tshuaj xyuas qhov siv tau ntawm tus ncej raug thiab khaws nws. "cap.read () yog qhov sib txawv boolean thiab rov qab muaj tseeb yog tias cov kab ntawv tau nyeem raug thiab yog tias koj tsis tau txais cov thav ntawv nws yuav tsis qhia qhov ua yuam kev, koj yuav yooj yim tsis tau.
Tam sim no kab 11 thiab kab 12 pib txhais qhov ntau ntawm cov xim peb xav tau los tshuaj xyuas. Rau qhov no, Kuv tau siv xim xiav.
Koj tuaj yeem txuas ntxiv nrog cov xim twg uas koj xav tau tsuas yog ntaus nqi BGR rau cov xim tshwj xeeb. Nws yog qhov zoo dua los txheeb xyuas ob lub arrays uas siv cov lej numpy raws li kuaj pom cov xim tshwj xeeb hauv lub ntiaj teb tiag yuav tsis ua haujlwm rau peb lub hom phiaj es peb yuav txiav txim siab ntau yam xim xiav kom nws pom nyob hauv thaj tsam.
Txog qhov no, Kuv tau piav qhia ob qhov sib txawv khaws cia qis dua BGR qhov tseem ceeb thiab qhov tseem ceeb BGR siab dua.
Kauj Ruam 4: Ntxuav thiab rho tawm
Tam sim no ntawm no los txog lub luag haujlwm tseem ceeb ntawm kev npog lub thav duab thiab tshem tawm cov xim ntawm lub thav duab. Kuv siv cov lus txib ua ntej tam sim no hauv lub tsev qiv ntawv hauv OpenCV los ua lub ntsej muag. Yeej qhov ncauj qhov ntswg yog txheej txheem tshem tawm qee feem ntawm tus thav duab, piv txwv li peb yuav tshem tawm cov pixels uas nws cov xim BGR qhov txiaj ntsig uas tsis dag hauv cov xim uas tau hais tseg thiab qhov no yog ua los ntawm cv2.inRange. Tom qab ntawd, peb siv cov xim sib txawv rau cov duab ua ntsej muag nyob ntawm qhov txiaj ntsig pixel thiab rau qhov no, peb yuav siv cv2.bitwise_and, Nws yuav yooj yim muab cov xim rau thaj tsam npog ntsej muag nyob ntawm daim npog ntsej muag thiab xim ntau yam.
Link cv 2 bitwise_and:
Kauj Ruam 5: Thaum kawg Tso Tawm
Ntawm no kuv tau siv qhov yooj yim cv2.imshow () rau tso rau txhua tus ncej ua duab. Txij li thaum kuv muaj cov ntaub ntawv thav duab khaws cia hauv qhov sib txawv Kuv tuaj yeem khaws lawv hauv imshow (). Ntawm no kuv tau nthuav tawm tag nrho peb lub thav duab, thawj, npog ntsej muag, thiab xim.
Tam sim no peb yuav tsum tawm ntawm lub voj thaum. Txog qhov no, peb tuaj yeem yooj yim siv cv2.wait. Key (). Yeej nws qhia lub sijhawm tos ua ntej teb. Yog li yog tias koj dhau 0 nws yuav tos tsis kawg thiab 0xFF qhia tus qauv tsim yog 64 ntsis. "ord ()" qhia meej txog tus cwj pwm uas thaum nias yuav ua tiav cov lus txib tawg hauv yog tias thaiv thiab nws yuav tawm ntawm lub voj.
Tom qab ntawd cap.release () kaw lub kaw video thiab cv2.destroyAllWindows () kaw txhua lub qhov rais qhib.
Yog tias koj muaj teeb meem, thov qhia rau kuv paub.
Txuas mus rau qhov chaws:
Pom zoo:
D.I.Y YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM LOS NTAWM SCRAPS: 4 Cov Kauj Ruam (nrog Duab)
D.I.Y YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM LOS NTAWM SCRAPS: Hnub no kuv xav qhia yuav ua li cas kom pom lub teeb pom kev zoo los ntawm lub zog xa hluav taws xob tsis siv hluav taws xob los ntawm tus txhuam txhuam hniav thiab lub tshuab solenoid valve coils uas tau khaws los ntawm scrapyard.Ua ntej pib, thov saib cov vis dis aus hauv qab no:
Kev Ceeb Toom Hluav Taws Xob Siv Arduino [Hauv Qhov Yooj Yim Yooj Yim Yooj Yim]: 3 Kauj Ruam
Kev Ceeb Toom Hluav Taws Xob Siv Arduino [Hauv Ob Qes Yooj Yim Yooj Yim]: Puas yog koj tab tom nrhiav kom ua txoj haujlwm yooj yim thiab nthuav nrog Arduino uas nyob rau tib lub sijhawm tuaj yeem muaj txiaj ntsig tiag tiag thiab muaj peev xwm cawm txoj sia? tej yam tshiab thiab tshiab. Hauv kab ntawv no peb mus
Txoj Kev Yooj Yim thiab Yooj Yim Los Hloov Koj Lub Xauv Screen hauv 6 Cov Kauj Ruam Yooj Yim (Windows 8-10): 7 Kauj Ruam
Txoj Kev Yooj Yim thiab Yooj Yim Los Hloov Koj Lub Xauv Screen hauv 6 Cov Kauj Ruam Yooj Yim (Windows 8-10): Xav hloov pauv yam ntawm koj lub laptop lossis PC? Xav tau kev hloov pauv hauv koj qhov chaw? Ua raws cov kauj ruam no yooj yim thiab yooj yim kom ua tiav koj tus kheej lub computer ntsuas phoo
YUAV UA LI CAS YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM TSHAJ PLAWS YOOJ YIM: 4 Cov Kauj Ruam
YUAV UA LI CAS YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM TSHAJ PLAWS: Nyob zoo txhua tus hauv cov lus qhia no kuv yuav qhia koj yuav ua li cas kom yooj yim " SOIL DRYNESS SENSOR ". Qhuav ntawm cov av tau txheeb xyuas siv qhov taw qhia coj. Lub teeb ci wi
Ib qho yooj yim heev/yooj yim/Tsis yooj yim txoj hauv kev kom tib neeg/tib neeg/tsiaj/neeg hlau zoo li lawv muaj txias tiag tiag/Lub zeem muag tshav kub kub (Xim ntawm Koj Xaiv) Siv GIMP: 4 Cov Kauj Ruam
Ib qho yooj yim heev/yooj yim/Tsis yooj yim txoj hauv kev kom tib neeg/tib neeg/tsiaj/neeg hlau zoo li lawv muaj txias tiag tiag/Lub zeem muag tshav kub kub (Xim ntawm Koj Xaiv) Siv GIMP: Nyeem … lub npe