Inverse 0 and 255 of a matrice in Java OpenCv -
next topic ( getperspectivetransform on non entire quadrangle ), i'm finding way track little dots white on edges table in of cases. if use binary threshold, works if choose arbitrarily threshold. problem edges color table influenced light. decided convert image on hsv , use inrange function keeps pixels between values program determines (i adapt theses values based on mean value of edge table (brown in of cases...)). function returns matrice pixels between range set 255, else 0.
i want inverse matrice, mean switch pixels val=0 255 , pixel val=255 0. here simple code (it doesn't work, nothing) :
for (int i=0; i<mat.rows(); i++){ (int j=0; j<mat.cols(); j++){ if (mat.get(i,j).get(0)[0] == 0){ mat.put(i,j,255); } else { mat.put(i,j,0); } } }
if know how in java, nice.
Comments
Post a Comment