How to compair between two lines in binary images?
이전 댓글 표시
Dear all,
I want to compare between two lines in two binary images (each image has one line as shown in the attachment).
One line is suppose to be more noisy than the other one (line_39 is more noisy than line_30). How can I differentiate between them. Is there someway to measure the noisiness of a line in binary images?
I tried to measure the standard deviation but I am not sure if this is a correct way:
I = imread('line30.tif');
B = bwboundaries(Line);
xy = B{1};
x_vals = xy(:,1);
y_vals = xy(:,2);
A = [x_vals ones(size(x_vals))];
b = y_vals;
sol = A\b;
m = sol(1);
c = sol(2);
errs = (m*x_vals + c) - y_vals;
std(errs)
Any idea how to do that?
Any help will be appreciated.
Meshoo
답변 (4개)
Salaheddin Hosseinzadeh
2014년 8월 21일
편집: Salaheddin Hosseinzadeh
2014년 8월 21일
Hi Meshoo,
I guess you can do it in different ways.
What I think of, is Fourier analysis.
Forget about the x axis, I would find the position of each 1(white spot)
find(I == 1);
and store it's y parameter in variable called "Y" then I get fft of Y and compare it's frequency with the other image. Noise should increase the amplitude of the higher frequencies!
Then you can add (sum) all the frequency amplitudes and the grater the summation the higher the noise!
sum(abs(fft(Y)))); % something like this
If you tried it please let me know about its result.
Regards,
Salah
Salaheddin Hosseinzadeh
2014년 8월 21일
You may also want to try diff
Just like before, get the line out your picture by finding its white spots.
Get diff of its Y values and
sum(abs(diff(Y)))
This may also work
Please let me know the result!! I'm very curious to know!
댓글 수: 2
Meshooo
2014년 8월 22일
Image Analyst
2014년 8월 22일
Did you try my suggestion? I have and it works for me.
Image Analyst
2014년 8월 21일
0 개 추천
What I've done is to fit the y data to a polynomial, like a line or quadratic. Then calculate the RMS or MAD difference between the data and the fitted curve.
댓글 수: 4
Meshooo
2014년 8월 22일
Salaheddin Hosseinzadeh
2014년 8월 22일
Thanks for your reply Meshoo, and sorry I couldn't help much.
Image Analyst
2014년 8월 22일
Like Salaheddin said, you don't need any toolbox to calculate differences, absolute values, and squares - it's just basic built in math. First you fit the curves with polyfit() and polyval() - again, built in to base MATLAB, not in toolboxes. See attached polyfit demo if you need an example.
Meshooo
2014년 8월 25일
Salaheddin Hosseinzadeh
2014년 8월 22일
0 개 추천
Meshooo
How about to find the mean value of the curve, specially that it's a line, and consider it as a fitted curve, just as Image Analyst said, and then do the rest of your analysis? You don't need any toolbox for this.
Just consider you're dealing with a error, forget about line, analyze the error, find its mean, variance or RMS or standard dev and ...
One of them should give u a clue hopefully.
카테고리
도움말 센터 및 File Exchange에서 Big Data Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!