Skip to content

Instantly share code, notes, and snippets.

@seth10
Created July 28, 2017 19:34
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 seth10/a2890f74c267d5dbfa8a7045be79349d to your computer and use it in GitHub Desktop.
Save seth10/a2890f74c267d5dbfa8a7045be79349d to your computer and use it in GitHub Desktop.
- # Find the index of the blob with the most pixels.
- most_pixels = 0
- largest_blob = 0
- for i in range(len(blobs)):
- if blobs[i].pixels() > most_pixels:
- most_pixels = blobs[i].pixels()
- largest_blob = i
+ # Find the blob with the most pixels.
+ largest_blob = max(blobs, key=lambda b: b.pixels())
https://github.com/openmv/qt-creator/pull/2/commits/847070ce0a7d4dd670f1c6928f3f24f8ee7a8924
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment