How to read distance between two laser lines on an object

Hello readers, I have a task to solve that maybe out of my depth.
I want to measure a distance between two red ( laser ) lines on an image / live camera feed. , or perhaps just measure the line length .
Apart from trig aspects that take into account angle of view from the object and distance etc, what type of software is used to undertake this task ?
A bit like pixel counting to a specific scale / ratio .
I can post a photo of the task if it requires more detail .
Thanks for reading . Apologies if this is in the wrong Category, most topics here are well above my pay grade. Cheers Stu

Hi Stu,

I may be out of my element here, but as far as I can understand, there is no solution to your problem as-is.

It’s not about just measuring the distance between two points in space from a 2D image. Most tools that do this have dedicated hardware like this.

If you ignore anything regarding distance or geometry, you can use ImageJ’s line tool to draw a Line ROI between the two points.
This gives you a distance in pixels which you can calibrate to something if you want.

See relevant parts here:
ImageJ Line Tools
Spatial Calibration Info

This is what im trying to read in a simple example …the surface wont be as smooth as this , but if you move the cylinder forward or backward , the distance between the lines moves … now the thing is , the cylinder diameters will always be different, so I cannot predetermine the dimension from a scale as such , although there probably is a formula that would work . Reading the distance between the two lines is what I want t do , as imagine a tool cutting along these two lines , you are left with a known flat surface width . I have a couple of commercial camera automation sites to pursue, so hopefully they can help me select the correct equipment. Again , many thanks for the reply . Cheers Stu

It will look more like this , you will see a top line , and end line , and the underside line ….the top line and the bottom line are from two different lasers that are perfectly lines up on the same angle , so the become one line if the cyclinder is removed ,.,the end line ( running vertical here ) is part of the top laser , where its line creates a profile as it runs down the end of the cylinder . Im only interested in the distance between the top and bottom line which can change when you move the cylinder randomly in different positions . You can see if you slice the cylinder along the its length , at the edge of the lines , you are left with a rectangle . Its important to read the distance between them visually , as the cylinder will not be a perfect shape nor will it it be parallel to the lasers at any one time…but it will still show a shape , that I must measure between .

You mention points and here you show lines, so I am a bit confused.

But if you have two points that are quite bright or easy to make out in an image, you can extract their color component, use a 2d maximum finder, and if you truly only detect two points, compute the distance between them.

This is pretty straightforward in Fiji, and you could build something using MicroManager with a compatible camera. I imagine the industry standard is closer to using Labview, or Matlab and such.

If speed is important, I know of OpenCV that runs on video feeds and you can code whatever you want and works in Python

But your question of “What software” is too vague I’m afraid.

Thanks , very interesting. The ’ two points ’ I referred to is Find the minimum distance between the two lines in the camera image … realtime is most important . I drew this here quickly but in real life , the lines will be bumpy and not straight , however there will be a particular place somewhere in the image that is the minimum . In the example above with the lines being parallel , the maximum distance is also the minimum . The project requires to find the minimum distance . Im not familiar with the methods discussed above in your reply , I have heard of LabVIEW and MATLAB I think …Fiji to me is a place to go on holiday and also a Japanese flow wrapper LOL , but I surely will now do a lot of reading .The final integration of the detected distance will need to be written to an industrial computer / programmable logic controller ( of which this is my normal back ground ) . Speed is important but sadly the python will constrict me before I know enough to use it. I sincerely appreciate your time for the responses. I will research these topics now . Cheers Stu