Skip to content

Instantly share code, notes, and snippets.

@jabbate19
Created November 3, 2020 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jabbate19/6e3e01111a1a4d7d44baf39a417db61c to your computer and use it in GitHub Desktop.
Save jabbate19/6e3e01111a1a4d7d44baf39a417db61c to your computer and use it in GitHub Desktop.
Imgproc.cvtColor( input, input, Imgproc.COLOR_RGB2HSV );
Core.inRange( input, new Scalar( hueMin, satMin, valMin ),
new Scalar( hueMax, satMax, valMax ), input );
Mat target = input.submat( new Rect( topLeft, bottomRight ) );
double avg = (int) Core.mean( target ).val[ 0 ];
Imgproc.rectangle( input, topLeft, bottomRight, new Scalar( 0, 250, 0 ), 2 );
telemetry.addData("Average", avg);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment