Progress Report: The code is posted, I'm done with this for a while.
This screenshot is the program working on Marcus' 45 degree shot.
The color channels are processed independently.
A point is selected as the sweep center.
A diameter is swept through 180 degrees at discrete angles
At each angle, "volatility" is measuring across the diameter. A trace is made for each channel gathering samples. The sample value is a linear interpolation of the four corner values of whichever grid square the sample spot lands on.
For each channel trace
The samples are multiplied by a VonHann window function
A Smooth/Differ pass is made on the samples
The RMS of the Differ is used as a volatility measure
The lower row graphs are:
First is the sweep of 0 to 180 degrees, each pixel is 0.5 degrees. Second is the sweep around the selected angle, each pixel is 0.1 degrees. Third is the sweep around the selected angle, each pixel is 0.01 degrees. Fourth is the trace Differ curve
The initial selection is the minimal average volatility of the three channels. This will be close, but usually not on, the best angle. The symmetry at the trough is a better indicator than the minimum. A best fit parabola in that neighborhood should yield a very good answer.
The source code (in Gambas, PPA gambas-team/gambas3) can be found at:
https://forum.gambas.one/viewtopic.php?f=4&t=707
It is an ordinary zip file, so you don't have to install Gambas to look at the source. The files are in the ".src" subdirectory.
Removing the VonHann window yields higher accuracy because it effectively lengthens the trace, but adds wobbles. Perhaps a double VonHann would be better as the center is unimportant and a quicker onset of "when the teeter-totter hits the ground" will be detected. Accuracy can easily be improved my increasing the trace length as far as the image allows (Yes, that's automatible). A better window function, sinc?
The measures I have taken at the current settings confirm the 3.19 value +/-.03 ish.
This is just the measuring tool. There are several strategies I can think of to apply it to the image. That, as they say, is an exercise for the reader. Or in this case, the OP. I'll be trying my own later.
There's head room for improvement in both the algorithm and the program, but already they are really useful.
Here is how the linear interpolation works
'---- Whole Number Portion
x = Floor(rx)
y = Floor(ry)
'---- Fractional Portions
fx = rx - x
fy = ry - y
gx = 1.0 - fx
gy = 1.0 - fy
'---- Weighted Average
vtl = ArgValues[x, y] * gx * gy ' Top Left
vtr = ArgValues[x + 1, y] * fx * gy ' Top Right
vbl = ArgValues[x, y + 1] * gx * fy ' Bottom Left
vbr = ArgValues[x + 1, y + 1] * fx * fy ' Bottom Rigth
v = vtl + vtr + vbl + vbr
Anybody know the conventional name for that?