Skip to content

ReferenceError: cv is not defined #3

@WisarutBholsithi

Description

@WisarutBholsithi

Now, I just try to use OpenCV in javascript for my project that use Angular Platform and I have already declare cv in he following fashion.

import {CV as cv} from "@techstark/opencv-js"

However, when I just declare that

/// human_face.ts
setHead(head: FaceComposition, params?: {}): FaceComposition {
const imageObject = head.imageObj;
const canvas = head.canvas;
const context = head.context;
......const imgData = context.getImageData(0, 0, canvas.width, canvas.height);
let src = cv.matFromImageData(imgData); // => ERROR ReferenceError: cv is not defined
// the way to get image data from canvas context for OpenCV processing!
....
}

I got a problem when i try use function cv.matFromImageData. as "ERROR ReferenceError: cv is not defined", it seems to me that opencv.js has failed to load properly according to the error message.

Therefore, I would like to know how to ensure that opencv.js would be properly loaded into the web.
Hope to get answer son,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions