Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to divide a mat matrix by ineger

hi, i want to divide a mat varible of 5x5 ones matrix by integer 25 in android opencv. i have done this in c++. the code is as follows :-

c++ code :- float kernel[5][5] = {{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1}}; Mat ker = Mat(5, 5, CV_32F, &kernel); // float data == CV_32F Mat ker=ker/25;

android code :- Mat kernel = new MatOfInt( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 );

    Core.divide(25, kernel, kernel);

both of them gives different result. as i want result achived from c++ code.

thanks !!

click to hide/show revision 2
No.2 Revision

updated 2014-10-28 04:51:33 -0600

berak gravatar image

How to divide a mat matrix by ineger

hi, i want to divide a mat varible of 5x5 ones matrix by integer 25 in android opencv. i have done this in c++. the code is as follows :-

c++ code :- :-

float kernel[5][5] = {{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1}};
Mat ker = Mat(5, 5, CV_32F, &kernel); // float data == CV_32F Mat
ker=ker/25;

ker=ker/25;

android code :- :-

Mat kernel = new MatOfInt(
                1, 1, 1, 1, 1,
                1, 1, 1, 1, 1,
                1, 1, 1, 1, 1,
                1, 1, 1, 1, 1,
                1, 1, 1, 1, 1
                );

);

        Core.divide(25, kernel, kernel);

both of them gives different result. as i want result achived from c++ code.

thanks !!

click to hide/show revision 3
retagged

updated 2014-10-28 05:04:52 -0600

berak gravatar image

How to divide a mat matrix by ineger

hi, i want to divide a mat varible of 5x5 ones matrix by integer 25 in android opencv. i have done this in c++. the code is as follows :-

c++ code :-

float kernel[5][5] = {{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1}};
Mat ker = Mat(5, 5, CV_32F, &kernel); // float data == CV_32F Mat
ker=ker/25;

android code :-

Mat kernel = new MatOfInt(
                1, 1, 1, 1, 1,
                1, 1, 1, 1, 1,
                1, 1, 1, 1, 1,
                1, 1, 1, 1, 1,
                1, 1, 1, 1, 1
                );

        Core.divide(25, kernel, kernel);

both of them gives different result. as i want result achived from c++ code.

thanks !!

click to hide/show revision 4
No.4 Revision

updated 2014-10-28 05:06:55 -0600

berak gravatar image

How to divide a mat matrix by inegerinteger

hi, i want to divide a mat varible variable of 5x5 ones matrix by integer 25 in android opencv. i have done this in c++. the code is as follows :-

c++ code :-

float kernel[5][5] = {{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1}};
Mat ker = Mat(5, 5, CV_32F, &kernel); // float data == CV_32F Mat
ker=ker/25;

android code :-

Mat kernel = new MatOfInt(
                1, 1, 1, 1, 1,
                1, 1, 1, 1, 1,
                1, 1, 1, 1, 1,
                1, 1, 1, 1, 1,
                1, 1, 1, 1, 1
                );

        Core.divide(25, kernel, kernel);

both of them gives different result. as i want result achived achieved from c++ code.

thanks !!