Detect a sinusoid in an image
Ältere Kommentare anzeigen
Hi all,
I am fairly new to image processing in MATLAB and I'm trying to learn as much as possible. So my aim is to extract a sinusoid that is drawn on graph paper which has been scanned in as an image. As i said, I am fairly new to image processing and trying very hard to learn as much as possible.
So the image has a sinusoid which is time varying and the background is that of a graph paper.
Could anyone point me in the right direction to go about accomplishing this task please?
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 1 Jun. 2012
0 Stimmen
What do you mean by detect? How about this:
sinusiodPixels = grayImage < thresholdValue;
That will give you a binary image of anything dark on your paper. Or so you want the parameters like the wavelength and amplitude?
4 Kommentare
HASNAIN
am 1 Jun. 2012
Image Analyst
am 1 Jun. 2012
Get the red channel - it will be dark where your curve is
redChannel = rgbImage(:,:, 1);
% Threshold it
binaryImage = redChannel < 128;
% Crop to get rid of axes, tick marks, etc.
% You supply this code. Hint: imcrop() or use indexing to extract a submatrix.
% Then find row # for each column
for col = 1 : size(redChannel, 2)
xy(col, 1) = col; % x value
xy(col, 2) = find(binaryImage(:, col), '1', 'first'); % y value
end
Now you have the x and y values for the curve. Assuming this is a homework problem, I'll let you figure out how to get the equation from the x,y values. Good luck.
HASNAIN
am 1 Jun. 2012
Image Analyst
am 1 Jun. 2012
I see you need some more help. So I downloaded your image and discovered it was an indexed image rather than an RGB image. So I made slight modifications to the code to get the blue sine wave, and added the parts on getting the x,y coordinates and transforming them into calibrated coordinates and plotting. See code in my other Answer here on this page.
Kategorien
Mehr zu Image Arithmetic finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
