Inspiration

Facial recogision program

What it does

counts numbers of insects

How we built it

we based our project to a similar funcitionin program that count faces instead of bugs

Challenges we ran into

Variables dont match to the expected result, light souress vary in each picture

Accomplishments that we're proud of

it works

What we learned

python

What's next for InsectesVuker

idk

CODE

import cv2 import numpy as np import matplotlib.pyplot as plt

image = cv2.imread('proba2.jpg') gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) plt.imshow(gray, cmap = 'gray')

blur = cv2.GaussianBlur(gray, (11,11), 0) plt.imshow(blur, cmap='gray')

canny = cv2.Canny(blur, 30, 150, 3) plt.imshow(canny, cmap='gray')

dilated = cv2.dilate(canny, (1,1), iterations = 2) plt.imshow(dilated, cmap='gray')

(cnt, heirarchy) = cv2.findContours(dilated.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) cv2.drawContours(rgb, cnt, -1, (0,255,0), 2)

plt.imshow(rgb)

print('Mosques en la imatge: ', len(cnt)) plt.show()

Built With

Share this project:

Updates