how to get the function of a curve in an image by matlab

1 次查看(过去 30 天)
hi all
id like to know if there is any way if I have the photo of a lets say sinusoidal curve and need to extract its function , how is it possible to do in matlab ? also i need to know how to let matlab distinguish the curve of the function in the image

采纳的回答

Image Analyst
Image Analyst 2014-3-5
Yes, it is. You can threshold the image and use find() to find the top-most pixel in the curve. So that will be your signal. You can then get the period and amplitude and thus define the equation.

更多回答(1 个)

farzad
farzad 2014-3-6
thank you so much but please can you elaborate it ? what did you mean by threshold the image ? and in the find , I should enter the x,y value of the point that i already know ?
  1 个评论
Image Analyst
Image Analyst 2014-3-6
Let's say the curve is black on a white background. And there is nothing else in the image, like you've cropped it so no axes are there, it's just the signal. You can do
binaryImage = grayImage < 128; % or whatever value works.
[rows, columns, numberOfColorChannels] = size(grayImage);
% For each column, find the pixel that's highest -
% that will be the y signal value for that column.
for c = 1 : columns
y(c) = rows - find(binaryImage(:,c), 1, 'first') + 1;
end

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by