Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
farzad
farzad le 5 Mar 2014
Commenté : Image Analyst le 6 Mar 2014
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

Réponse acceptée

Image Analyst
Image Analyst le 5 Mar 2014
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.

Plus de réponses (1)

farzad
farzad le 6 Mar 2014
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 commentaire
Image Analyst
Image Analyst le 6 Mar 2014
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

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by