private void applyChanges() { for( int i = 0; i < change.size; i++ ) { ChangeInfo c = change.get(i); binary.set(c.x, c.y, c.value); // System.out.println(" "+c.x+" "+c.y+" = "+c.value); } }
private void applyChanges() { for( int i = 0; i < change.size; i++ ) { ChangeInfo c = change.get(i); binary.set(c.x, c.y, c.value); // System.out.println(" "+c.x+" "+c.y+" = "+c.value); } }
private void changeValue( int x , int y , int value ) { changed.get(x,y,data); if( data[0] == 0 ) { changed.set(x,y,1); change.grow().set(x,y,value); } }
private void changeValue( int x , int y , int value ) { changed.get(x,y,data); if( data[0] == 0 ) { changed.set(x,y,1); change.grow().set(x,y,value); } }
public static void classifyEuclidean( Planar<GrayF32> input , Gaussian3D_F64 model , double threshold, InterleavedU8 output ) { threshold = threshold*threshold; GrayF32 A = input.getBand(0); GrayF32 B = input.getBand(1); GrayF32 C = input.getBand(2); double meanA = model.mean[0]; double meanB = model.mean[1]; double meanC = model.mean[2]; for( int y = 0; y < input.height; y++ ) { for( int x = 0; x < input.width; x++ ) { double a = A.unsafe_get(x,y)-meanA; double b = B.unsafe_get(x,y)-meanB; double c = C.unsafe_get(x,y)-meanC; double dist = a*a + b*b + c*c; if( dist <= threshold ) output.set(x,y,1); else output.set(x,y,0); } } } }
public static void classify(Planar<GrayF32> input , Gaussian3D_F64 model , double thresholdChiSq, InterleavedU8 output ) { GrayF32 A = input.getBand(0); GrayF32 B = input.getBand(1); GrayF32 C = input.getBand(2); model.computeInverse(); for( int y = 0; y < input.height; y++ ) { for( int x = 0; x < input.width; x++ ) { float a = A.unsafe_get(x,y); float b = B.unsafe_get(x,y); float c = C.unsafe_get(x,y); double dist = chisq(model.mean,model.covarianceInv,a,b,c); if( dist <= thresholdChiSq ) output.set(x, y, 1); else output.set(x,y,0); } } }
public static void classify(Planar<GrayF32> input , Gaussian3D_F64 models[] , double thresholdChiSq, InterleavedU8 output ) { GrayF32 A = input.getBand(0); GrayF32 B = input.getBand(1); GrayF32 C = input.getBand(2); for( Gaussian3D_F64 model : models ) model.computeInverse(); for( int y = 0; y < input.height; y++ ) { for( int x = 0; x < input.width; x++ ) { float a = A.unsafe_get(x,y); float b = B.unsafe_get(x,y); float c = C.unsafe_get(x,y); boolean positive = false; for( int i = 0; i < models.length; i++ ) { Gaussian3D_F64 model = models[i]; double dist = chisq(model.mean,model.covarianceInv,a,b,c); if( dist <= thresholdChiSq ) { output.set(x, y, 1); positive = true; break; } } if( !positive) output.set(x,y,0); } } }