java - How to lighten a rectangle with opencv for android -


i'm using opencv android , wonder how lighten rectangle surface in mat object.

i write function add 30 each rgb component of each pixel in area., works way expected slowly.

public mat oncameraframe(cvcameraviewframe inputframe) {     mat frame = inputframe.rgba();     int h = 300;     int w = (int) ((int) ( (float) h ) * 1.5);      return drawrectangle(frame, h, w); }  private mat drawrectangle(mat frame, int h, int w){     for( int y = (frame.rows() - h) / 2 ; y < (frame.rows() + h) / 2 ; y++ ) {          for( int x = (frame.cols() - w) / 2; x < (frame.cols() + w) / 2; x++ ) {             for( int c = 0; c < 3; c++ ) {                 double[] color = frame.get(y, x);                 for(int = 0; < 3; i++)                     color[i] += 30;                  frame.put(y, x, color);              }         }     }     return frame; } 

i'm sure there way instantly (i've seen example of b&w, negative effects instantly processed) i'm not familiar opencv , android, guess don't know philosophy yet.

access area directly cvrect , use overloaded +:

cv::mat img; int x,y,w,h,inc; img(cv::rect(x, y, w, h))+=cvscalar(inc,inc,inc); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -