Skip to content

divide1

Core and matricesfunctionOpenCV 5.0.0
import { divide1 } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSscale, src2, dst, dtype
FUNCTIONdivide1
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Performs per-element division of two arrays or a scalar by an array.

The function cv::divide divides one array by another:

\texttt{dst(I) = saturate(src1(I)*scale/src2(I))}

or a scalar by an array when there is no src1 :

\texttt{dst(I) = saturate(scale/src2(I))}

Different channels of multi-channel arrays are processed independently.

For integer types when src2(I) is zero, dst(I) will also be zero.

Note: In case of floating point data there is no special defined behavior for zero src2(I) values. Regular floating-point division is used. Expect correct IEEE-754 behaviour for floating-point data (with NaN, Inf result values).

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Note: (Python) Be careful to difference behaviour between src1/src2 are single number and they are tuple/array. divide(src,X) means divide(src,(X,X,X,X)). divide(src,(X,)) means divide(src,(X,0,0,0)).

See: multiply, add, subtract

divide1(scale: number, src2: Mat, dst: Mat, dtype: number): void;
2 available overloads
divide1(scale: number, src2: Mat, dst: Mat): void;
divide1(scale: number, src2: Mat, dst: Mat, dtype: number): void;
scale

scalar factor.

src2

second input array of the same size and type as src1.

dst

Output destination, filled by the native operation. output array of the same size and type as src2.

dtype

optional depth of the output array; if -1, dst will have depth src2.depth(), but in case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth().

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.