IS this right or not about calculation of Total Variation (TV) for image y?
Show older comments
for a natural image it is difficult to calculate SNR so total variation (TV) will be calculated as an evaluation to noise.
for y(i,j)
TV=(sqrt(y(i,j)-y(i-1,j))^2+(y(i,j)-y(i+1,j))^2+(y(i,j)-y(i,j-1))^2+(y(i,j)-y(i,j+1))^2);
how can this implemented for a whole image ?
2 Comments
VINSHI KK
on 19 Nov 2017
What indicates the variation of i and j .Is it image size?
Image Analyst
on 19 Nov 2017
Yes, i and j range over the image dimensions. So i = 1 : rows and j = 1 : columns.
Accepted Answer
More Answers (2)
David Young
on 14 Jan 2012
I don't know, but an easy initial check is to see whether it gives the same answer as
var(y(:))
or possibly
var(y(:), 1)
(See the documentation for var.)
Image Analyst
on 14 Jan 2012
That's just the sum of the squares of a differences of a pixel value with its 3 nearest neighbors values plus the difference of one pair not squared. How is that a variance? Who says the center pixel is the mean of the 4 neighbors? Plus you didn't divide by (N-1) even if it were the mean. And I don't know what "Total" Variance is - how does it differ from the regular variance that everyone is familiar with? And your first term:
sqrt(y(i,j)-y(i-1,j))^2
is identical to y(i,j)-y(i-1,j) since you're just taking the square root and squaring it. So you're adding a linear term to two squared terms.
I think you need to think this through some more.
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!