Skip to main content

Frame

A single frame, as seen by the camera.

Properties​

bytesPerRow​

• bytesPerRow: number

Returns the amount of bytes per row.

Defined in​

Frame.ts:20


height​

• height: number

Returns the height of the frame, in pixels.

Defined in​

Frame.ts:16


isValid​

• isValid: boolean

Whether the underlying buffer is still valid or not. The buffer will be released after the frame processor returns, or close() is called.

Defined in​

Frame.ts:8


planesCount​

• planesCount: number

Returns the number of planes this frame contains.

Defined in​

Frame.ts:24


width​

• width: number

Returns the width of the frame, in pixels.

Defined in​

Frame.ts:12

Methods​

close​

â–¸ close(): void

Closes and disposes the Frame. Only close frames that you have created yourself, e.g. by copying the frame you receive in a frame processor.

Example

const frameProcessor = useFrameProcessor((frame) => {
const smallerCopy = resize(frame, 480, 270)
// run AI ...
smallerCopy.close()
// don't close `frame`!
})

Returns​

void

Defined in​

Frame.ts:48


toString​

â–¸ toString(): string

Returns a string representation of the frame.

Example

console.log(frame.toString()) // -> "3840 x 2160 Frame"

Returns​

string

Defined in​

Frame.ts:33