MATLAB Answers

Why my Differential Total Variation (DTV) code doesn't working correctly?

7 views (last 30 days)
Mohammad Al Nagdawi
Mohammad Al Nagdawi on 24 Oct 2018
Edited: Mohammad Al Nagdawi on 28 Oct 2018
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,[3 4])
imshow(mat2gray(abs(gradR_r - gradR_f));
%%residual image r
% vector L1 norm
E = sum(abs(gradR_r(:) - gradR_f(:))); %eq. 1
The output is not working correctly.
What is the mistake I did?


Sign in to comment.

Answers (0)