i’m very new to opencv…
i need to predict in between value from the two linear data array in opencv.Wat i’m going to do for that…For example we use interp1 function in matlab.
tab =
1950 150.697
1960 179.323
1970 203.212
1980 226.505
1990 249.633
then the population in 1975, obtained by table lookup within the matrix tab, is
p = interp1(tab(:,1),tab(:,2),1975)
p =
214.8585
How can we do this in opencv…please help me..Thanks in advance.
You could try to use the regression functions build into OpenCV. But for the simple linear interpolation you seem to be doing it might be easier to just write it yourself.
This function linearly interpolates the target value given to two given datapoints.
If you want to use it like the matlab function, supplying all datapoints at once, you need a function which picks the two nearest neighbors. Something like this:
And here is a small example showing how to use it:
I did not test this extensively. So you might need to fix some bugs.