# Frequency of a sine wave

Apologies for the probably very simple question, I'm just getting to grips with OpenCV and image processing in general (steep learning curve!)

I have an image (that can almost be thought of as a sine wave), the top portion of the image is black, and the bottom half of it white (essentially the midline is the sine wave).

What I'm trying to do is work out the amount of peaks and check if there are deformaties in the line, the way I have thought of doing this would be to get the co-ordinates for each of the peaks and troughs of the wave and doing some simple geometry on them to do the checks.

However I cannot see any functions (although I could be blind!) that allow for this type of matching and reporting of points. Would anyone have any suggestions? Its almost a line detection but a wavy line.

edit retag close merge delete

Sort by ยป oldest newest most voted

If your image is more or less black and white, getting the peaks is fairly easy. Write an algorithm that follows the sine wave and you get its pixel positions. Computing the peaks is then simply done by comparing the positions if the x or y value (column/row) starts decreasing instead of increasing and vice versa.

I don't how how thick your wave is, but by skeletonization, you can get a one pixel wide line which would be easier to check for deformities and stuff.

I don't have much time atm, so can't offer you any code, but I hope that I could have been of help.

more

I think this is the biggest problem though :P Finding / writing the algorithm (or function) in OpenCV to follow the sine wave.

( 2013-07-11 12:01:01 -0500 )edit

Could you give an example of your image?

( 2013-07-11 12:29:11 -0500 )edit

Official site

GitHub

Wiki

Documentation