PANDORE Version 6 GREYC-IMAGE

pdivneumann



Computes the divergence by backward finite differences.



Synopsis

pdivneumann [-m mask] [im_in1|-] [im_in2|-] [im_out|-]

Description

pdivneumann computes the divergence by backward finite differences. The result is a grayscale image im_out, where:

 im_out(i,j) = (im_in1(i,j)-im_in1(i-1,j)) + (im_in2(i,j)-im2(i,j-1)),

with special care (Neumann) at boundaries:

im_in1(1,j) and -im_in1(n-1,j)
im_in2(i,1) and -im_in2(i,n-1)

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, pgradneumann

C++ prototype

Errc PDivNeumann( const Img2d<U> &im_in1, Img2d<U> &im_in2, Img2d<U> &im_out );

Version française

Calcul de la divergence par différence finies décentrée à gauche.


Author: Jalal Fadili