Opencv.js Uncaught TypeError: fields[fieldName].write is not a function

asked 2019-12-10 13:08:13 -0600

sundowatch gravatar image

updated 2019-12-10 14:28:04 -0600

Hi everyone,

I'm trying to use cv.GaussianBlur() on OpenCV.js, but it gives error like that:

Uncaught TypeError: fields[fieldName].write is not a function
at Object.toWireType (opencv4.js:24)
at Object.blur (eval at new_ (opencv4.js:24), <anonymous>:9:26)
at Object.blur (opencv4.js:24)
at HTMLImageElement.img.onload (custom.js:120)

There is no problem with cv.cvtColor() function, but when try to use GaussianBlur or blur, it gives error.

I'm using OpenCV on JavaScript as opencv.js

I'm using Opencv.js 4.1 from this link: https://docs.opencv.org/4.1.0/opencv.js

I've only added <script type="text/javascript" async src="opencv.js></script>" to load the opencv.js

edit retag flag offensive close merge delete

Comments

1

opencv version ? os ? what did you install, and from where ?

please add the resp. code to your question ;)

berak gravatar imageberak ( 2019-12-10 13:17:53 -0600 )edit
1

Updated :)

sundowatch gravatar imagesundowatch ( 2019-12-10 14:32:44 -0600 )edit

By the way it happens for both blur() and GaussianBlur()

sundowatch gravatar imagesundowatch ( 2019-12-10 15:57:01 -0600 )edit
1

You still don't show the code that fails. But you lack the onload() callback to tell you when OpenCV is loaded. Some functions may not be ready when you call them.

mvuori gravatar imagemvuori ( 2019-12-11 02:18:56 -0600 )edit