Cov txheej txheem:
- Kauj Ruam 1: Teeb duab duab plaub rau ntawm Lub Cim Pom Zoo
- Kauj Ruam 2: Txheeb Tawm Txoj Hauv Kev Uas Lub Hom Phiaj Tau Mooved
- Kauj Ruam 3: Ua ke Ob Qhov Cai
Video: Opencv Object Tracking: 3 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Kev txheeb xyuas cov khoom txav yog cov txheej txheem siv hauv kev pom lub computer thiab ua cov duab. Ntau kab sib law liag los ntawm cov vis dis aus raug sib piv los ntawm ntau txoj hauv kev los txiav txim siab yog tias pom cov khoom txav mus.
Kev txheeb xyuas cov khoom txav tau siv rau ntau yam kev siv xws li kev saib xyuas video, kev lees paub kev ua haujlwm, kev saib xyuas xwm txheej, kev nyab xeeb hauv tshav dav hlau, saib xyuas kev tiv thaiv raws ntug dej hiav txwv thiab lwm yam.
Kev txheeb xyuas qhov khoom txav yog kom paub txog lub cev txav ntawm ib yam khoom hauv ib qho chaw lossis thaj chaw. [2] Los ntawm kev ua segmentation ntawm cov khoom txav chaw thiab thaj chaw nyob ruaj khov lossis thaj chaw, cov khoom txav mus los tuaj yeem taug qab thiab yog li tuaj yeem tshuaj xyuas tom qab. Txhawm rau ua tiav qhov no, txiav txim siab cov vis dis aus yog tus qauv tsim los ntawm ib tus thav duab, txav cov khoom pom yog nrhiav pom lub hauv ntej txav mus rau lub hom phiaj (ib qho), hauv txhua kab duab video lossis tsuas yog thaum lub hom phiaj txav qhia pom thawj zaug hauv daim vis dis aus.
Kuv yuav siv Opnecv thiab Python ua ke txhawm rau txheeb xyuas thiab taug qab cov khoom raws li xim
Kauj Ruam 1: Teeb duab duab plaub rau ntawm Lub Cim Pom Zoo
yog tias koj lub pc tsis muaj nab hab sej lossis opencv thov ua raws li cov hauv qab no hauv kev tsim kho
nov yog tus nab npawb nab npawb:
import cv2import numpy as np
cap = cv2. VideoCapture (0)
thaum Muaj Tseeb:
_, ncej = cap.read () hsv = cv2.cvtColor (ncej, cv2. COLOR_BGR2HSV)
lower_yellow = np.array ([20, 110, 110])
upper_yellow = np.array ([40, 255, 255])
yellow_mask = cv2.inRange (hsv, qis dua -yellow, Upper_yellow)
(_, contours, _) = cv2.findContours (daj_mask, cv2. RETR_TREE, cv2. CHAIN_APPROX_SIMPLE)
rau contour nyob rau hauv contours:
cheeb tsam = cv2.contourArea (contour)
yog (thaj tsam> 800):
x, y, w, h = cv2.boundingRect (contour) thav duab = cv2.rectangle (thav duab, (x, y), (x+w, y+h), (0, 0, 255), 10)
cv2.imshow ("taug qab", thav duab)
k = cv2.waitKey (5) & 0XFF
yog tias k == 27: so
cv2.destroyAllWindows ()
cap.release () thov
Kauj Ruam 2: Txheeb Tawm Txoj Hauv Kev Uas Lub Hom Phiaj Tau Mooved
taug txoj kev:
rau kuv hauv ntau (1, len (center_points)): b = random.randint (230, 255) g = random.randint (100, 255) r = random.randint (100, 255) yog lej.sqrt (((center_points [i - 1] [0] - center_points [0]) ** 2) + ((center_points [i - 1] [1] - center_points [1]) ** 2)) <= 50: cv2.line (ncej, center_points [i - 1], center_points , (b, g, r), 4)
Kauj Ruam 3: Ua ke Ob Qhov Cai
kuv yuav mus koom ob txoj cai
ntshuam cv2import numpy li np ntshuam random los ntawm kev sau ntshuam deque
cap = cv2. VideoCapture (1)
# Txhawm rau taug qab txhua kis uas cov khoom mus xyuas center_points = deque ()
thaum Muaj Tseeb:
# Nyeem thiab tig tus ncej _, thav duab = cap.read () thav duab = cv2.flip (thav duab, 1)
# Qhov muag plooj me ntsis
blur_frame = cv2. GaussianBlur (thav duab, (7, 7), 0)
# Hloov los ntawm BGR rau HSV hom xim
hsv = cv2.cvtColor (blur_frame, cv2. COLOR_BGR2HSV)
# Txheeb cais qis thiab sab saud ntawm hsv xim kom pom. Xiav ntawm no
lower_blue = np.array ([100, 50, 50]) upper_blue = np.array ([140, 255, 255]) mask = cv2.inRange (hsv, lower_blue, upper_blue)
# Ua cov elliptical kernel
kernel = cv2.getStructuringElement (cv2. MORPH_ELLIPSE, (15, 15))
# Qhib morph (yaig tom qab nthuav dav)
mask = cv2.morphologyEx (daim npog, cv2. MORPH_OPEN, kernel)
# Nrhiav txhua daim duab
contours, hierarchy = cv2.findContours (mask.copy (), cv2. RETR_LIST, cv2. CHAIN_APPROX_SIMPLE) [-2:]
yog len (contours)> 0:
# Nrhiav qhov loj tshaj contour biggest_contour = max (contours, qhov tseem ceeb = cv2.contourArea)
# Nrhiav qhov chaw nruab nrab ntawm daim duab thiab kos lub voj voog
moments = cv2.moments (biggest_contour) centre_of_contour = (int (moments ['m10'] / moments ['m00']), int (moments ['m01'] / moments ['m00'])) cv2.circle (thav duab, centre_of_contour, 5, (0, 0, 255), -1)
# Ciam lub contour nrog lub voj voog
ellipse = cv2.fitEllipse (biggest_contour) cv2.ellipse (thav duab, ellipse, (0, 255, 255), 2)
# Txuag qhov chaw nruab nrab ntawm daim phiaj kom peb kos kab taug qab nws
center_points.appendleft (centre_of_contour)
# Kos kab los ntawm cov ntsiab lus nruab nrab ntawm daim duab
rau kuv hauv ntau (1, len (center_points)): b = random.randint (230, 255) g = random.randint (100, 255) r = random.randint (100, 255) yog lej.sqrt (((center_points [i - 1] [0] - center_points [0]) ** 2) + ((center_points [i - 1] [1] - center_points [1]) ** 2)) <= 50: cv2.line (ncej, center_points [i - 1], center_points , (b, g, r), 4)
cv2.imshow ('thawj', thav duab)
cv2.imshow ('daim npog', daim npog)
k = cv2.waitKey (5) & 0xFF
yog tias k == 27: so
cv2.destroyAllWindows ()
cap.release () thov
Pom zoo:
Head Motion Tracking System rau VR: 8 Kauj Ruam
Lub Taub Hau Motion Tracking System rau VR: Kuv lub npe yog Sam KODO, Hauv qhov kev qhia no, Kuv yuav qhia koj ib qib zuj zus tias yuav siv Arduino IMU sensors li cas txhawm rau tsim lub taub hau rau VR hauv qhov haujlwm no koj yuav xav tau: - Ib qho LCD Zaub HDMI : https: //www.amazon.com/Elecrow-Capacitive-interfac…- Ib
Pixy2Bot Object Follower (Servo Code): 4 Kauj Ruam
Pixy2Bot Object Follower (Servo Code): Tsim lub hom phiaj yooj yim hauv qab no neeg hlau (tsis muaj yias/qaij tshuab) nrog Arduino Uno + Lub Cev Tsav Tsheb, ob qhov pheej yig txuas ntxiv servos thiab Pixy2. Video: https://youtu.be/lxBLt5DJ5BM
RASPBERRY PI Pi OBJECT DETECTION WITH MULTIPLE CAMERA'S: 3 Kauj Ruam
RASPBERRY PI Pi OBJECT DETECTION WITH MULTIPLE CAMERA'S: Kuv yuav khaws cov lus luv luv, raws li lub npe nws tus kheej qhia tias lub hom phiaj tseem ceeb ntawm kev qhia yog dab tsi. Hauv cov lus qhia ib qib zuj zus, kuv yuav piav qhia koj yuav ua li cas txuas ntau lub koob yees duab zoo li 1-pi cam thiab tsawg kawg ib lub koob yees duab USB, lossis 2 lub koob yees duab USB
Raspberry Pi Object Counting: 5 Kauj Ruam
Raspberry Pi Lub Hom Phiaj Suav: Lub zeem muag ntawm lub computer, tsis ntseeg, yog qhov zoo tshaj plaws! Siv qhov no, lub khoos phis tawj tau txais lub peev xwm rau " saib " thiab paub zoo ib puag ncig ib puag ncig, dab tsi tso cai rau kev txhim kho ntawm cov ntawv nyuaj, muaj txiaj ntsig thiab txias. Cov ntawv thov xws li fa
Jetson Nano Quadruped Robot Object Detection Tutorial: 4 Kauj Ruam
Jetson Nano Quadruped Robot Object Detection Tutorial: Nvidia Jetson Nano yog cov khoom tsim tawm, uas suav nrog SoM (System ntawm Module) thiab pawg thawj coj saib xyuas siv. Nws yog lub hom phiaj tseem ceeb tshaj plaws rau kev tsim cov kab ke uas xav tau kev ua haujlwm siab rau tshuab kev kawm, tshuab lub zeem muag thiab cov vis dis aus