Ask Your Question

Revision history [back]

Javascript and Webcam with OpenCV putText is not a function


i have an Raspebrry Pi 3 and want to use it for have an Webinterface to see the Livestream from the webcam. With OpenCV i will to ad some text etc on the Video Stream.

Now i already have a Livestream from the webcam to an webinterface. For this i use the Code from here:

To use OpenCV in Javscript i use this: (

in the main.js file i have try this: var cv = require('opencv4nodejs');


var frameCallback = function (image) {

console.log("Funktion: frameCallback");

//image.putText (text, Punkt, 1 , 10, Farben , 1 , 1, 1, false);

var font = cv.FONT_HERSHEY_SIMPLEX cv.putText(image,'Test',(10,500), font, 4,(255,255,255),2,cv.LINE_AA)

var frame = {

    type: "frame",

    frame: new Buffer(image, "ascii").toString("base64")


//umwandlung in ein String Fromat

var raw = JSON.stringify(frame);

for (var index in clients) {




But i geht this error:

TypeError: image.putText is not a function at frameCallback (/home/pi/node-camera/src/main.js:66:11) terminate called after throwing an instance of 'std::runtime_error' what(): OpenCV Error: (key_ != -1 && "Can't fetch data from terminated TLS container.") in getData, in file /home/pi/opencv-3.4.3/modules/core/src/system.cpp, line 1593, status -215

can someone help me ? Do you need more information ? Please ask.