Skip to content

sort

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

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

ARGUMENTSsrc, dst, flags
FUNCTIONsort
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Sorts each row or each column of a matrix.

The function cv::sort sorts each matrix row or each matrix column in ascending or descending order. So you should pass two operation flags to get desired behaviour. If you want to sort matrix rows or columns lexicographically, you can use STL std::sort generic function with the proper comparison predicate.

See: sortIdx, randShuffle

sort(src: Mat, dst: Mat, flags: number): void;
src

input single-channel array.

dst

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

flags

operation flags, a combination of #SortFlags

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.