Ask Your Question
0

How to multiply cv.Mat by scalar in JS?

asked 2020-05-03 14:00:08 -0600

mikit gravatar image

updated 2020-05-03 21:06:24 -0600

supra56 gravatar image

We cannot use operator* unlike C++.

It seems cv.multiply is only for mat * mat (element-wise).

How can I multiply Mat by scalar?

Currently, I use cv.multiply(mat, cv.ones(h, w, cv.CV_8UC1), 255)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-08-27 00:14:38 -0600

VonChenpPlus gravatar image

Mat's operator* is actually performed by gemm, so you can use cv.gemm instead.

edit flag offensive delete link more

Comments

1

no, that's wrong, as "per-element" multiplication was required

berak gravatar imageberak ( 2020-08-27 04:33:21 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-05-03 13:55:56 -0600

Seen: 1,169 times

Last updated: Aug 27 '20