Why my Differential Total Variation (DTV) code doesn't working correctly?
5 views (last 30 days)
Show older comments
I try to implement Differential total variation (DTV) as described in (Wu, Y. et al 2017) or (Li, Y. et al 2015).
I implemented (Wu, Y. et al 2017) since it simpler:
function E = DTV_wu(r_img,f_img)
% r_img and f_img: images we try to calc. the similarity between them.
%%find grandiant domain for the images-> (forward finite difference)
[rx ry] = imgradientxy(r_img,'intermediate');
[fx fy] = imgradientxy(f_img,'intermediate');
%%L2 norm as (wu, y. et al, 2017)
gradR_r = (rx.^2 + ry.^2 ).^0.5;
gradR_f = (fx.^2+ fy.^2).^0.5;
subplot(2,2,1)
imshow(r_img);title('fix')
subplot(2,2,2);
imshow(f_img);title('flt')
subplot(2,2,[3 4])
imshow(mat2gray(abs(gradR_r - gradR_f));
%%residual image r
% vector L1 norm
E = sum(abs(gradR_r(:) - gradR_f(:))); %eq. 1
end
The output is not working correctly.
What is the mistake I did?
0 Comments
Answers (0)
See Also
Categories
Find more on Modify Image Colors 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!