Ask Your Question

kartik's profile - activity

2020-10-17 19:46:33 -0600 received badge  Popular Question (source)
2016-04-20 16:36:04 -0600 received badge  Editor (source)
2016-04-20 16:34:09 -0600 asked a question Coordinates in contour not Accurate/smooth

I'm working on a people counter system and i'm getting the coordinate of each blob detected through the following code:

contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE)
    try: hierarchy = hierarchy[0]
    except: hierarchy = []
    for contour, hier in zip(contours, hierarchy):
      (x,y),radius = cv2.minEnclosingCircle(contour)
      center = (int(x),int(y))
      radius = int(radius)
      if radius>3:
        cv2.circle(frame,center,1,(0,255,0),-1)
        if x>400 and x<450:
            if (abs(prev_x-x))>25:
              cv2.circle(frame,center,1,(0,255,0),-1)
              j=j+1
              prev_x=x

Now the coordinates from the rectangle i'm getting isn't smooth. Moreover the centre of circle i'm getting is'nt stable. Can anyone please suggest a better solution at getting the coordinates of each blob/contour smmothly which is not prone to noise and is stable? Mine is moving too waywardly and the moving of centres arent linear. If there's a different algorithm available then please do suggest. Thanks.

2016-04-19 16:43:13 -0600 commented answer Intersection of centroid and line/rectangle

Yes, mine is a bit noisy and the centroid does go back. So, i'm supposed to make two line equations and then put centroid x value into these two equations and check?

2016-04-19 16:38:15 -0600 received badge  Supporter (source)
2016-04-19 16:14:32 -0600 commented answer Intersection of centroid and line/rectangle

Thanks so much man! Umm, so i'll have to use two lines you're saying ? Sorry, i'm a bit confused.

2016-04-19 13:43:53 -0600 asked a question Intersection of centroid and line/rectangle

I'm currently making a traffic count system using opencv and python and what I exactly intend to do is that,to increment the counter as soon as the centroid of the blob passes or crosses a line or a small rectangle. My question is how to do this as I don't know how to implement cv2.lines or cv2.rectangle in this. Please see this video and if anybody could tell how exactly the intersection or counting is working in this video: https://www.youtube.com/watch?v=z1Cvn...

Thanks in advance.

2016-04-14 12:12:58 -0600 asked a question Blob Tagging with ID's in OpenCv Python

0 down vote favorite I am currently making a python code for people headcounting with direction. I have used 'moments'method to gather the coordinates and eventually when it crosses a certain line then the counter increments.But, this method is proving to be very inefficient. My question regarding the blob detection are:

  1. Is there any blob detection technique for python opencv? Or it could be done with cv2.findContours? I'm working on raspberry pi so could anyone suggest how to get blob library on debian linux?
  2. Even if there is, how could i get a unique ID for each blob? Is there any algorithm to provide tagging of UNIQUE ID's? If there's any better method to do this, kindly suggest an algorithm. Thanks in advance.