Ask Your Question

Frequency of a sine wave

asked 2013-07-11 10:45:00 -0500

mitch gravatar image

updated 2013-07-11 11:51:07 -0500

berak gravatar image

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 flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-07-11 11:50:13 -0500

Notas gravatar image

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.

edit flag offensive delete link more


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

mitch gravatar imagemitch ( 2013-07-11 12:01:01 -0500 )edit

Could you give an example of your image?

Notas gravatar imageNotas ( 2013-07-11 12:29:11 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2013-07-11 10:45:00 -0500

Seen: 507 times

Last updated: Jul 11 '13