Skip to content

GStreamingCompiled

gapiclassOpenCV 5.0.0
import { GStreamingCompiled } from '@banou/opencv-wasm'

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

ARGUMENTSConstructor or factory
CLASSGStreamingCompiled
RETURN TYPEOwned native handle
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Native object: release it with using or delete(). Factories can return null; check before calling methods.

\addtogroup gapi_main_classes

Represents a computation (graph) compiled for streaming.

This class represents a product of graph compilation (calling cv::GComputation::compileStreaming()). Objects of this class actually do stream processing, and the whole pipeline execution complexity is incapsulated into objects of this class. Execution model has two levels: at the very top, the execution of a heterogeneous graph is aggressively pipelined; at the very bottom the execution of every internal block is determined by its associated backend. Backends are selected based on kernel packages passed via compilation arguments ( see gapi_compile_args, GNetworkPackage, GKernelPackage for details).

GStreamingCompiled objects have a "player" semantics -- there are methods like start() and stop(). GStreamingCompiled has a full control over a videostream and so is stateful. You need to specify the input stream data using setSource() and then call start() to actually start processing. After that, use pull() or try_pull() to obtain next processed data frame from the graph in a blocking or non-blocking way, respectively.

Currently a single GStreamingCompiled can process only one video streat at time. Produce multiple GStreamingCompiled objects to run the same graph on multiple video streams.

See: GCompiled

Constructors and members

static new

Create an owned GStreamingCompiled object. Release native handles with using or delete().

new(): GStreamingCompiled;
Returns

The GStreamingCompiled result. Release returned native handles with using or delete(), including handles nested in results.

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;
Returns

The this result.

start

Start the pipeline execution.

Use pull()/try_pull() to obtain data. Throws an exception if a video source was not specified.

setSource() must be called first, even if the pipeline has been working already and then stopped (explicitly via stop() or due stream completion)

Note: This method is not thread-safe (with respect to the user side) at the moment. Protect the access if start()/stop()/setSource() may be called on the same object in multiple threads in your application.

start(): void;

stop

Stop (abort) processing the pipeline.

Note - it is not pause but a complete stop. Calling start() will cause G-API to start processing the stream from the early beginning.

Throws if the pipeline is not running.

stop(): void;

running

Test if the pipeline is running.

Note: This method is not thread-safe (with respect to the user side) at the moment. Protect the access if start()/stop()/setSource() may be called on the same object in multiple threads in your application.

running(): boolean;
Returns

true if the current stream is not over yet.

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.