Solved

# what exactly these functions do to narrow matrix ranges

Posted on 2007-07-30

If anyone can help me understand what this function does, I would appreciate it:

cvAbsDiffS(Image1, Image2, s);

What is the functions doing to the array? How does it use "s" scalar value to do that? Finally, this function and cvSubS have been suggested to select out pixel hue ranges to isolate color in HSV space. I understand HSV space, just not what these functions are doing to the arrays passed through them.

AbsDiffS

Calculates absolute difference between array and scalar

void cvAbsDiffS( const CvArr* A, CvArr* C, CvScalar S );

#define cvAbs(A, C) cvAbsDiffS(A, C, cvScalarAll(0))

A

The source array.

C

The destination array.

S

The scalar.

The function cvAbsDiffS calculates absolute difference between array and scalar.

C(I)c = abs(A(I)c - Sc).

All the arrays must have the same data type and the same size (or ROI size).

------------------

SubS

Computes difference of array and scalar

void cvSubS( const CvArr* A, CvScalar S, CvArr* C, const CvArr* mask=0 );

A

The source array.

S

Subed scalar.

C

The destination array.

mask

Operation mask, 8-bit single channel array; specifies elements of destination array to be changed.

The function cvSubS subtracts a scalar from every element of the source array:

C(I)=A(I)+S if mask(I)!=0

All the arrays must have the same type, except the mask, and the same size (or ROI size)

----------------------------------------

If I understood what calculations were being employed, I could pick the correct S scalar value to choose a hue range.

Help...

WLE