Measurement of moving objects using computer vision

I am working on a project to measure lengths of the black objects and distance between them using computer vision (Shown below in the fig.). These objects are moving on a conveyor shown in the blue color. The speed of the conveyor belt is known(0-1m/s) at every instance.Due to limited field of view of the camera, its not possible to have complete object length in a single frame , how can I measure the object lengths in this case? As I have very little knowledge of computer vision, I am finding it difficult to search the algorithms relevant for solving this problem. Any help with keywords, algorithms, resources is appreciated.

My first instinct is to use line detection algorithms for detecting object edges and calculate distance between them, based on speed and time.Also, how difficult is it to stitch multiple images based on speed to get a complete object?

how difficult is it to stitch multiple images based on speed to get a complete object?

Trivial. If you know the speed and the time at which an image was taken, it's just a linear translation...

My first instinct is to use line detection algorithms for detecting object edges and calculate distance between them, based on speed and time.

Excellent approach!

Just: reduce your image to a single row, maybe the average of the 10 center rows from your picture.

That reduces your problem from 2D to 1D.

Then, the question you have is "when does that start and stop being black?", which is trivial to answer if you just convert that color row to its brightness, and use a threshold.

• Did I read "trivial" and "threshold" in the same sentence? ;) Commented Dec 18, 2019 at 20:29
• @Markus Thank you for the answer. If I may extend the question, is it possible to get the lengths measurements without considering speed of the conveyor, as integrating speed will lead to drift and larger errors in measurements of longer objects ? Commented Dec 18, 2019 at 21:15
• @LaurentDuval hehehe, "empirical value" :D Commented Dec 19, 2019 at 12:31
• @Siddhesh yes, but then you'll actually need to derive the position from the video – that can be easy, for example if your conveyor belt has something like distance labels on it. Else, you need to start doing things like estimating shift – not overly complex (also just a (set of)1D cross-correlation), but definitely more computationally intense :) Commented Dec 19, 2019 at 12:33