Skip to content

Instantly share code, notes, and snippets.

@Seagor
Created April 26, 2016 14:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Seagor/6de79d11ac8d10f1061e6b9a5bd64f24 to your computer and use it in GitHub Desktop.
Save Seagor/6de79d11ac8d10f1061e6b9a5bd64f24 to your computer and use it in GitHub Desktop.
import pandas as pd
areas = []
for i, img in enumerate(found_objects):
for r, reg in enumerate(img):
for cnt in reg['contours']:
areas.append((cv2.contourArea(cnt), r, i))
df = pd.DataFrame(data = areas, columns=['area', 'dock', 'image'])
df.plot(kind='scatter', x='dock', y='area', figsize=(10, 5), c='gray', s=df['area'], ylim=(0,600), title="Object area by Dock")
df.plot(kind='scatter', x='image', y='area', figsize=(10, 5), s=75)
df.plot(kind='scatter', x='dock', y='image', figsize=(10, 5), s=df['area'])
plt.figure();
df['area'].plot(kind='hist', bins=15, figsize=(10, 5), x='Area')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment