1 | initial version |
you don't need any conversion or 2d array for this. just do:
Core.divide(mat, new Scalar(64), mat); // 256/64 = 8
Core.multiply(mat, new Scalar(64), mat); // 8*64 = 256
2 | No.2 Revision |
you don't need any conversion or 2d array for this. just do:
Core.divide(mat, new Scalar(64), mat); // 256/64 = 8
8 (bins)
Core.multiply(mat, new Scalar(64), mat); // 8*64 = 256
256 (back to orig. value range)
3 | No.3 Revision |
you don't need any conversion or 2d array for this. assuming, your image is 8U, just do:
Core.divide(mat, new Scalar(64), mat); // 256/64 = 8 (bins)
Core.multiply(mat, new Scalar(64), mat); // 8*64 = 256 (back to orig. value range)
(it's a simple integer division, which does the trick.)
4 | No.4 Revision |
you don't need any conversion or 2d array for this. assuming, your image is 8U, just do:
Core.divide(mat, new Scalar(64), Scalar(32), mat); // 256/64 256/32 = 8 (bins)
Core.multiply(mat, new Scalar(64), Scalar(32), mat); // 8*64 8*32 = 256 (back to orig. value range)
(it's a simple integer division, which does the trick.)