Ask Your Question

Revision history [back]

click to hide/show revision 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

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)

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.)

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.)