Image counting algorithm for counting objects on a moving conveyor

I am building a vision system that can count boxes moving on a conveyor belt at a variable speed.

Using open_cv and C ++, I could separate the drops and extract the corresponding centroids.

Now I need to increase the counter if the centroid crosses the cutoff boundary line.

Please view the screenshots for greater clarity (three frames marked with thresholds and centroids):

Screenshot of 3 frames, thresholded and centroids marked.

This is where I am stuck. I tried 2 options.

  • Fixing a rectangular strip where the centroid will remain for only one frame
    • But since the conveyor has a multi-speed speed, I could not fix a constant boundary value.
  • I tried something like

    centroid_prev = centroid_now;
    centroid_now = posX;
    if (centroid_now >= xLimit && centroid_prev < xLimit)
    {
        count++;
    }
    
    • This works great if there is only one box on the conveyor.

    • , .

,   blob ,   ?

PS. 50 , , .

+4
3

, , , , , - . , , - goodFeaturesToTrack calcOpticalFlowPyrLK .
, , , , . , , X .

(< 100), , .

0

? OpenCV . ( , , .)

: 5-10 , .

0

. , -

for(i=0; i<centroid.length; i++)
  centroid_prev[i] = centroid[i].posX;

for(frame j=0 to ...) {

 ... recompure centroids

for(i=0; i<centroid.length; i++) {
  centroid_now = centroid[i].posX;
  if (centroid_now >= xLimit && centroid_prev[i] < xLimit)
  {
  count++;
  }
}

for(i=0; i<centroid.length; i++)
  centroid_prev[i] = centroid[i].posX;

}// end j

-

( ), , ​​ , .

0

Source: https://habr.com/ru/post/1621932/


All Articles