Closed GSunilc closed 2 years ago
Hey, Post the complete code and the error!!
import cv2 import numpy as np
cap=cv2.VideoCapture ('video.mp4') min_width_react=80 #min width reactangle min_height_react=80 #min width reactangle count_line_postion= 550
algo=cv2.createBackgroundSubtractorMOG2() while True: ret,frame1=cap.read() grey=cv2.cvtColor(frame1,cv2.COLOR_BGR2GRAY) blur=cv2.GaussianBlur(grey,(3,3),5)
img_sub=algo.apply(blur)
dilat=cv2.dilate(img_sub,np.ones((5,5)))
kernel=cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(5,5))
dilatada=cv2.morphologyEx(dilat,cv2.MORPH_CLOSE,kernel)
dilatada=cv2.morphologyEx(dilatada,cv2.MORPH_CLOSE, kernel)
counterSahpe,h=cv2.findContours(dilatada,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
cv2.line(frame1,(25,count_line_postion),(1200,count_line_postion),(255,127,0),3)
for (i,c) in enumerate(counterSahpe):
(x,y,w,h)=cv2.boundingRect(c)
validate_counter=(w>= min_width_react) and (h>= min_height_react)
if not validate_counter:
continue
cv2.rectangle(frame1,(x,y),(x+w,y+h),(0,225,0),2)
cv2.imshow('video original',frame1)
if cv2.waitKeyEx(1)==13:
break
cv2.destroyAllWindows()
cap.release()
It runs well in 1st iteration and getting error after that.
Bro is their any specific height and angle in which camera should be installed.help me in this plz it's urgent.....
if you are detecting the moving vehicles number plate then make sure that you capture the frames and try your detection model on every frame then you can check in which frame range you are getting the best answer....capture those frames frequently.
Also, one more possible thing that you can do is try applying different models and compare the results. Keep the best possible result.
Thanks for the response.i already posted my code have you gone through it and find any issue. It's urgent for me .plz help me.
On Thu 17 Mar, 2022, 8:38 AM Rajeev Nayan Agrawal @.*** wrote:
Hey, Post the complete code and the error!!
— Reply to this email directly, view it on GitHub https://github.com/datasciencecompleteguide/Machine-Learning/issues/43#issuecomment-1070081541, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYIFNYO4H6O2KB6BCPAN733VAKO3VANCNFSM5Q4LLLXQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.*** com>
File "D:\vehicle 2\import", line 13, in grey-cv2.cvtColor (frame1, cv2.COLOR_BGR2GRAY)
I am getting this error ,but I am using recorded mp4 video.p lz help me