Description of sopt_mltb_TV_norm
Description: sopt_mltb_TV_norm - Compute TV norm

Home > matlab > misc > sopt_mltb_TV_norm.m

# sopt_mltb_TV_norm

## PURPOSE

sopt_mltb_TV_norm - Compute TV norm

## SYNOPSIS

function y = sopt_mltb_TV_norm(u, sphere_flag,incNP, weights_dx, weights_dy)

## DESCRIPTION

     sopt_mltb_TV_norm - Compute TV norm

     Compute the TV of an image on the plane or sphere.

     Inputs:

       - u: Image to compute TV norm of.

       - sphere_flag: Flag indicating whether to compute the TV norm on the
           sphere (1 = on sphere, 2 = on plane).

       - includeNP: Flag indicating whether the North pole is included
           in the sampling grid (1 = North pole included, 0 = North pole not
           included).

       - weights_dx: Weights in the x (phi) direction.

       - weights_dy: Weights in the y (theta) direction.

     Outputs:

       - y: TV norm of image.

## CROSS-REFERENCE INFORMATION

This function calls:

- sopt_mltb_gradient_op sopt_mltb_gradient_op - Compute gradient
- sopt_mltb_gradient_op_sphere sopt_mltb_gradient_op_sphere - Compute gradient on sphere

This function is called by:

## SOURCE CODE

    0001 function y = sopt_mltb_TV_norm(u, sphere_flag, ...
    0002     incNP, weights_dx, weights_dy)
    0003 % sopt_mltb_TV_norm - Compute TV norm
    0004 %
    0005 % Compute the TV of an image on the plane or sphere.
    0006 %
    0007 % Inputs:
    0008 %
    0009 %   - u: Image to compute TV norm of.
    0010 %
    0011 %   - sphere_flag: Flag indicating whether to compute the TV norm on the
    0012 %       sphere (1 = on sphere, 2 = on plane).
    0013 %
    0014 %   - includeNP: Flag indicating whether the North pole is included
    0015 %       in the sampling grid (1 = North pole included, 0 = North pole not
    0016 %       included).
    0017 %
    0018 %   - weights_dx: Weights in the x (phi) direction.
    0019 %
    0020 %   - weights_dy: Weights in the y (theta) direction.
    0021 %
    0022 % Outputs:
    0023 %
    0024 %   - y: TV norm of image.
    0025
    0026 if sphere_flag
    0027     if nargin>3
    0028         [dx, dy] = sopt_mltb_gradient_op_sphere(u, incNP, weights_dx, weights_dy);
    0029     else
    0030         [dx, dy] = sopt_mltb_gradient_op_sphere(u, incNP);
    0031     end
    0032 else
    0033     if nargin>3
    0034         [dx, dy] = sopt_mltb_gradient_op(u, weights_dx, weights_dy);
    0035     else
    0036         [dx, dy] = sopt_mltb_gradient_op(u);
    0037     end
    0038 end
    0039 temp = sqrt(abs(dx).^2 + abs(dy).^2);
    0040 y = sum(temp(:));
    0041
    0042 end