Ask Your Question
1

I want to multiply a matrix with a number !

asked 2016-02-24 01:20:50 -0600

Pulkit gravatar image

I am using opencv in android studio.

i want:

Mat A;

Mat B;

int num= 255;

B = A*255;

But it is not working.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2016-02-24 02:02:33 -0600

berak gravatar image

there are no builtin 'operators' for this in java, you'll have to use Core.multiply , like:

Mat A = ...;
Mat B = new Mat();
Scalar s = new Scalar(13);
Core.multiply(A, s, B);

note, since B will get saturated on overflow, you probably need to convert A to a larger type, like CV_32F

edit flag offensive delete link more

Comments

It Worked for me . Thanks for the answer @berak Cheers !!

Pulkit gravatar imagePulkit ( 2016-02-24 23:26:44 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-02-24 01:20:50 -0600

Seen: 3,736 times

Last updated: Feb 24 '16