dnn_superres_DnnSuperResImpl
import { dnn_superres_DnnSuperResImpl } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Native object: release it with using or delete(). Factories can return null; check before calling methods.
A class to upscale images via convolutional neural networks. The following four models are implemented:
- edsr
- espcn
- fsrcnn
- lapsrn
Constructors and members
static create
Empty constructor for python
create(): dnn_superres_DnnSuperResImpl | null;The dnn_superres_DnnSuperResImpl | null result.
clone
Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.
clone(): this;The this result.
readModel
Read the model from the given path
readModel(path: EmbindString): void;pathPath to the model file.
setModel
Set desired model
setModel(algo: EmbindString, scale: number): void;algoString containing one of the desired models:
- edsr
- espcn
- fsrcnn
- lapsrn
scaleInteger specifying the upscale factor
setPreferableBackend
Set computation backend
setPreferableBackend(backendId: number): void;backendIdbackend id argument (number).
setPreferableTarget
Set computation target
setPreferableTarget(targetId: number): void;targetIdtarget id argument (number).
upsample
Upsample via neural network
upsample(img: Mat, result: Mat): void;imgImage to upscale
resultOutput destination, filled by the native operation. Destination upscaled image
upsampleMultioutput
Upsample via neural network of multiple outputs
upsampleMultioutput(img: Mat, imgs_new: MatVector, scale_factors: IntVector, node_names: StringVector): void;imgImage to upscale
imgs_newDestination upscaled images
scale_factorsScaling factors of the output nodes
node_namesNames of the output nodes in the neural network
getScale
Returns the scale factor of the model:
getScale(): number;Current scale factor.
getAlgorithm
Returns the scale factor of the model:
getAlgorithm(): string;Current algorithm.
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.