Detect a sinusoid in an image
古いコメントを表示
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?
採用された回答
その他の回答 (1 件)
Image Analyst
2012 年 6 月 1 日
0 投票
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 件のコメント
HASNAIN
2012 年 6 月 1 日
Image Analyst
2012 年 6 月 1 日
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
2012 年 6 月 1 日
Image Analyst
2012 年 6 月 1 日
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.
カテゴリ
ヘルプ センター および File Exchange で Image Arithmetic についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
