Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

while this is possible, you clearly should not do per pixel operations, but prefer opencv's high level, hardware optimized functions , especially on android, where it's gross slow.

double [] pixel = mat.get(y,x);
mat.put(x,y, pixel);

in most cases, it's faster, to get all of the pixels into a buffer, operate on that, and put() it back later:

byte [] buffer = new byte[mat.total() * mat.elemSize()];
mat.get(0,0,buffer);
// process buffer ...
mat.put(0,0,buffer);

but again, use add(), subtract(), and the like, whenever possible !