How to compair between two lines in binary images?
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (4)
Salaheddin Hosseinzadeh
on 21 Aug 2014
Edited: Salaheddin Hosseinzadeh
on 21 Aug 2014
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
0 Comments
Salaheddin Hosseinzadeh
on 21 Aug 2014
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 Comments
Image Analyst
on 21 Aug 2014
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 Comments
Image Analyst
on 22 Aug 2014
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.
Salaheddin Hosseinzadeh
on 22 Aug 2014
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.
0 Comments
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!