DSP: Measuring angles of edges in images
Posted
#1
(In Topic #269)
Regular

This project is in support of my DSP StackExchange answer at:
computer vision - Auto Detection of Rotation Angle on Arbitrary Image with Orthogonal Features - Signal Processing Stack Exchange
There is a reduced size sample image included with the zip. The original and a link to the full sized source image (52M) is at the DSP.SE post linked above. There is a screen shot of the form towards the end of my answer.
This project allows you to measure angles in images. The ideal case is a well defined straight edge.
On the form, there are two rows of images. On the top row are the source image, a close up, and an RGB channels image. Click on the source image to capture an sample section. Next, click either on the close up view, or the capture portion of the RGB image, to take a measurement at that spot.
The bottom row contains the result of that measurement. Click on any of the sweep graphs (black background) to take a reading at the corresponding angle. The selected angle is shown on the form.
The graphs show the "volatility" of the pixel color values along the trace. The actual value is the RMS of the squiggly thing on the right. See the link above, or the code, for more detail. The accuracy and precision is very image and usage dependent.
The source files are:
FMain.form
FMain.class
SweepClass.class - Holds Sweep parameters and three channel Orient
OrientClass.class - Does the sweeps for each color channel
SlantClass.class - The work horse, plays the role of all the diameters
ParabolicScaleClass.class - Converts zoom scroll bar value to zoom level
This is a rather unembellished program. It does show how to do some image processing and could be a good starter program for image processing programs.
Ced
Here is how the smoother/differ works:
Code (gambas)
- '=============================================================================
- '---- Forward
- myForward[0] = ArgSamples[0]
- myForward[n] = (ArgSamples[n] + myForward[n - 1]) * 0.5
- '---- Backward
- myBackward[myMaxIndex] = ArgSamples[myMaxIndex]
- myBackward[n] = (ArgSamples[n] + myBackward[n + 1]) * 0.5
- '---- Calculate Smoothed and Differed
- ReturnSmooth[n] = (myBackward[n] + myForward[n]) * 0.5
- ReturnDiffer[n] = (myBackward[n] - myForward[n]) * 0.5
- '=============================================================================
See my blog article: https://www.dsprelated.com/showarticle/896.php, Exponential Smoothing with a Wrinkle.
.... and carry a big stick!
Posted
Regular

<IMG src="https://i.stack.imgur.com/CGmi8.jpg">
</IMG>I've made a few small changes since and more to come. Look for a new post in a few days to a week.
Ced
.... and carry a big stick!
1 guest and 0 members have just viewed this.



