Counting bars/lines as they pass through ROI

Hi all,

I'm New to the community so apologies for the lack of knowledge. I'm thinking of a project where I want to measure depth of an needle/bar/catheter as it passes a certain point. The needles in question already has lines indicating Depth (1 line = 1 cm). Ie. I need some sort of optical sensor that’s able to detect the lines as the pass the optical sensor and count them as 1, it would also be helpful that the software can detect lines going in the opposite direction, ie. The needle is being taken out for whatever reason, however this is not critical at this point. I was hoping for an optical sensor.

See attached pictures for reference to the proposed needles even though I will be using needles/catheres that have solid single lines.

Thank you in advance for any suggestions!

Regards,
Håvard Jenssen

Is the needle being moved by a robot or a human?

Human only so one should expect random movement up and down. The needle will be fixed so no movement beyond vertical.

Then you'll need CV techniques - you can't rely on the human moving it as a consistent speed/direction without stopping, so counting lines crossing a given point won't be reliable.

Thanks for your reply! CV techniques meaning ?

Yeah, there will be no presumed consistency as the needle will go for specific targets which also may move. As a potential alternative the needle could have numbers indicating depth which is then read out electronically, suggestions to this approach?