Important: Please read the Qt Code of Conduct  https://forum.qt.io/topic/113070/qtcodeofconduct
Line Tracer/Digitizer

I am relatively new to QT and am looking to build a graph digitizer which runs manually (User clicks positions on graph) and automatically. I have managed to get the manual side of the graph working but am looking to build the automatic side.
This involves clicking on the line graph line to say select colour and then have the program automatically give a vector of positions for the line which could be saved into .csv and used to recreate a digital version of the graph image. I am currently using a QImage to import the graph picture.Any help would be well received

Hi and welcome to the forums
Since you have the manual part working click on the image and so on, what
part do you want help on ?
The math in the "automatically give a vector of position" or saving to
csv or where lies the dog ? ( not sure its the right expression :)

I need it to automatically detect the line and plot the points so instead of the user clicking several points on the line they instead click a couple and the program autofills the other points according to the line

@ParanoidAndroid
Ok and are those lines straight or more like a spline / curve ?
if just a line then
https://www.geeksforgeeks.org/programfindlinepassing2points/but since you asked for help i assume its something more complicated ?

@mrjj They can be any 2D line graph splines, straight, lines curves

@ParanoidAndroid
Ok. so we need the data these
2D line graph splines, straight, lines curves are based on if we are to calculate its
function based on a few points.Can i see one images with the drawn curves you wish to calculate ?

Here is an example of the spline

You need to read math, I'm afraid. Rational Bsplines, normal cubic splines or polyharmonic splines could work in your case, however I leave the wikipediaing to you. ;)

@kshegunov
Is there no way to say track the colour of the spline and give pixel coordinates

Sorry, I don't understand the question. Please rephrase.

@kshegunov instead of using mathematics could you say click to select the colour of the line and then have the application give the coordinates of every pixel connected with that colour

@ParanoidAndroid
Hi
If all images are as clean as this, you can easily scan to find the blue color and hence the Y coordinate.
https://doc.qt.io/qt5/qimage.html#pixel1
or the faster way
https://doc.qt.io/qt5/qimage.html#scanLineBut it wont be fast as such but unless
tiny mini board it should be fine:)

@mrjj thankyou for your help. Will this give an x coordinate aswell

@ParanoidAndroid said in Line Tracer/Digitizer:
Will this give an x coordinate aswell
Just iterate over all x coordinates and search for y like @mrjj suggested. Or iterate over y and get x...