protected static float safe ( int x , int y , GrayF32 image ) { if ( x < 0 ) x = 0 ; else if ( x >= image . width ) x = image . width - 1 ; if ( y < 0 ) y = 0 ; else if ( y >= image . height ) y = image . height - 1 ; return image . unsafe_get ( x , y ) ; }
Ensures pixel values are inside the image . If output it is assigned to the nearest pixel inside the image