PANDORE Version 6 GREYC-IMAGE

pgradneumann



Computes the discrete gradient by forward finite differences and Neumann boundary conditions.



Synopsis

pgradneumann [-m mask] [im_in|-] [im_out1|-] [im_out2|-]

Description

pgradneumann computes the first derivative of the input image im_in. The result is two grayscale images, where im_out1 is the derivative along the x axis, and im_out2 is the derivative along the y axis:

 im_out1(i,j) = im_in(i+1,j)-im_in(i,j),
 im_out2(i,j) = im_in(i,j+1)-im_in(i,j), with im_out1(n-1) = 0 and im_out2(n-1) = 0.

Inputs

Outputs

Result

Returns SUCCESS or FAILURE.

Examples

Implements the gradient and divergence operators with Neumann boundary conditions such that one is the adjoint of the other, i.e. <grad x,u> = <-div u,x>. The script checks this identity.

protation 0 180 tangram.pan tangram1.pan
pgradneumann tangram.pan gim1_y.pan gim1_x.pan
pgradneumann tangram1.pan gim2_y.pan gim2_x.pan

# Compute < grad im1, grad im2>. 
pmult gim1_y.pan gim2_y.pan | psumvalue - s1.pan
sumvaly=`pstatus`
pmult gim1_x.pan gim2_x.pan | psumvalue - s2.pan
sumvalx=`pstatus`

innerproduct1=`echo "$sumvaly+$sumvalx" | bc -l`

# Compute <-div grad im1,im2>.
pdivneumann gim1_y.pan gim1_x.pan | pmultcst -1 - divim1.pan
pim2sf tangram1.pan t.pan
pmult divim1.pan t.pan | psumvalue - /dev/null
innerproduct2=`pstatus`

echo $innerproduct1
echo $innerproduct2

See also

Edge detection, pdivneumann

C++ prototype

Errc Errc PGradNeumann( const Img2d<U> &im_in, Img2d<U> &im_out1, Img2d<U> &im_out2 );

Version française

Calcul du gradient d'une image par différences finies décentrées à droite avec conditions aux bords de Neumann.


Author: Jalal Fadili