OpenCV Java Multiplication for values less than 1

When I perform per-element multiplication the values less than 1 are automatically set to zero since the result is by default double precision.

Core.multiply(src,Scalar(1/256.0, 1/256.0, 1/256.0),dest)

Note that the type of src and dest is CvType.CV_32FC3 . I tried src.mul(mat) and it does not work. Is there any solution to get floating values instead of these zeros.

crosspost:

please proove that :wink:

i also cannot repeat your problem:

Mat src = new Mat(3,3,CvType.CV_32FC3, new Scalar(10,20,30));
Mat dest = new Mat();
Core.multiply(src, new Scalar(1/256.0, 1/256.0, 1/256.0),dest);
cout(dest);
cout(dest.dump());


     [java] Mat [ 3*3*CV_32FC3, isCont=true, isSubmat=false, nativeObj=0x7f8d50152240, dataAddr=0x7f8d50152300 ]
     [java] [0.0390625, 0.078125, 0.1171875, 0.0390625, 0.078125, 0.1171875, 0.0390625, 0.078125, 0.1171875;
     [java]  0.0390625, 0.078125, 0.1171875, 0.0390625, 0.078125, 0.1171875, 0.0390625, 0.078125, 0.1171875;
     [java]  0.0390625, 0.078125, 0.1171875, 0.0390625, 0.078125, 0.1171875, 0.0390625, 0.078125, 0.1171875]


Thank you, i am not really sure if it is related to OpenCV version, but it returns the round of values. I made a for loop instead and it works.