Import
6
README.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
This repository contains all files for the Image recognition course of HU Electrical Engineering year 3.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Arne van Iterson
|
||||||
|
Tom Selier
|
0
md/notes.md
Normal file
18
md/nuts.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
### Jullie gaan noten herkennen
|
||||||
|
|
||||||
|
Hoe de neuk? Nut.
|
||||||
|
1. Hoe gaan we de noten herkennen (beeld, smaak, geluid, text)?
|
||||||
|
- Beeldherkenning lol
|
||||||
|
2. Wat zijn de visuele kenmerken van de noten?
|
||||||
|
- Vorm, kleur, textuur, grootte
|
||||||
|
3. Hoeveel noten willen we herkennen
|
||||||
|
- Qua type, hoeveel verschillende noten
|
||||||
|
- Qua tijd, hoeveel noten tegelijkertijd
|
||||||
|
4. Wat is de achtergrond
|
||||||
|
5. Met wat voor camera worden de noten bekeken
|
||||||
|
6. Is de noot verwerkt
|
||||||
|
|
||||||
|
De deelvragen moeten sequentieel zijn
|
||||||
|
|
||||||
|
|
||||||
|
Wij moeten presenteren volgende week
|
BIN
res/trees/accasia_sq1_original.png
Normal file
After Width: | Height: | Size: 2.4 MiB |
BIN
res/trees/berk_sq1_original.png
Normal file
After Width: | Height: | Size: 5.1 MiB |
BIN
res/trees/eik2_sq1_original.png
Normal file
After Width: | Height: | Size: 3.4 MiB |
BIN
res/trees/eik_sq1_original.png
Normal file
After Width: | Height: | Size: 5.4 MiB |
BIN
res/trees/els_sq1_original.png
Normal file
After Width: | Height: | Size: 2.9 MiB |
BIN
res/trees/es_sq1_original.png
Normal file
After Width: | Height: | Size: 5.8 MiB |
BIN
res/trees/esdoorn_sq1_original.png
Normal file
After Width: | Height: | Size: 5.7 MiB |
BIN
res/trees/linde_sq1_original.png
Normal file
After Width: | Height: | Size: 4.2 MiB |
BIN
res/trees/plataan1_sq1_original.png
Normal file
After Width: | Height: | Size: 6.5 MiB |
BIN
res/trees/plataan2_sq1_original.png
Normal file
After Width: | Height: | Size: 2.8 MiB |
44
src/adj.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import cv2
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
blur = 3
|
||||||
|
canny_low = 255
|
||||||
|
canny_high = 50
|
||||||
|
|
||||||
|
def on_change(value):
|
||||||
|
pass
|
||||||
|
|
||||||
|
img = cv2.imread("./res/trees/berk_sq1_original.png")
|
||||||
|
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
||||||
|
|
||||||
|
width = int(img.shape[1] * 40 / 100)
|
||||||
|
height = int(img.shape[0] * 40 / 100)
|
||||||
|
dim = (width, height)
|
||||||
|
|
||||||
|
# resize image
|
||||||
|
img = cv2.resize(img, dim, interpolation = cv2.INTER_AREA)
|
||||||
|
|
||||||
|
cv2.imshow('frame', img)
|
||||||
|
|
||||||
|
cv2.createTrackbar('Contrast', 'frame', 0, 25, on_change)
|
||||||
|
cv2.createTrackbar('Canny low', 'frame', 0, 1000, on_change)
|
||||||
|
cv2.createTrackbar('Canny high', 'frame', 0, 1000, on_change)
|
||||||
|
|
||||||
|
while(1):
|
||||||
|
# get data from trackbars
|
||||||
|
blur = cv2.getTrackbarPos('Blur rate', 'frame')
|
||||||
|
canny_low = cv2.getTrackbarPos('Canny low', 'frame')
|
||||||
|
canny_high = cv2.getTrackbarPos('Canny high', 'frame')
|
||||||
|
|
||||||
|
# Canny Edge Detection
|
||||||
|
edges = cv2.Canny(image=img, threshold1=canny_low, threshold2=canny_high)
|
||||||
|
|
||||||
|
# Display Canny Edge Detection Image
|
||||||
|
cv2.imshow("Canny Edge Detection", edges)
|
||||||
|
|
||||||
|
# wait for escape
|
||||||
|
k = cv2.waitKey(5) & 0xFF
|
||||||
|
if k == 27:
|
||||||
|
break
|
||||||
|
|
||||||
|
cv2.destroyAllWindows()
|
0
src/suite.py
Normal file
47
src/tree_edge.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import cv2
|
||||||
|
|
||||||
|
# Read the original image
|
||||||
|
img = cv2.imread("./res/trees/berk_sq1_original.png")
|
||||||
|
|
||||||
|
# Convert to graycsale
|
||||||
|
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
||||||
|
|
||||||
|
width = int(img_gray.shape[1] * 40 / 100)
|
||||||
|
height = int(img_gray.shape[0] * 40 / 100)
|
||||||
|
dim = (width, height)
|
||||||
|
|
||||||
|
# resize image
|
||||||
|
resized = cv2.resize(img_gray, dim, interpolation = cv2.INTER_AREA)
|
||||||
|
|
||||||
|
# Display original image
|
||||||
|
cv2.imshow("Original", resized)
|
||||||
|
|
||||||
|
# Blur the image for better edge detection
|
||||||
|
img_blur = cv2.GaussianBlur(resized, (3, 3), 0)
|
||||||
|
|
||||||
|
# Sobel Edge Detection
|
||||||
|
sobelx = cv2.Sobel(
|
||||||
|
src=img_blur, ddepth=cv2.CV_64F, dx=1, dy=0, ksize=5
|
||||||
|
) # Sobel Edge Detection on the X axis
|
||||||
|
sobely = cv2.Sobel(
|
||||||
|
src=img_blur, ddepth=cv2.CV_64F, dx=0, dy=1, ksize=5
|
||||||
|
) # Sobel Edge Detection on the Y axis
|
||||||
|
sobelxy = cv2.Sobel(
|
||||||
|
src=img_blur, ddepth=cv2.CV_64F, dx=1, dy=1, ksize=5
|
||||||
|
) # Combined X and Y Sobel Edge Detection
|
||||||
|
# Display Sobel Edge Detection Images
|
||||||
|
cv2.imshow("Sobel X", sobelx)
|
||||||
|
cv2.imshow("Sobel Y", sobely)
|
||||||
|
cv2.imshow("Sobel X Y using Sobel() function", sobelxy)
|
||||||
|
|
||||||
|
# Canny Edge Detection
|
||||||
|
edges = cv2.Canny(
|
||||||
|
image=resized, threshold1=150, threshold2=250
|
||||||
|
) # Canny Edge Detection
|
||||||
|
# Display Canny Edge Detection Image
|
||||||
|
cv2.imshow("Canny Edge Detection", edges)
|
||||||
|
cv2.waitKey(0)
|
||||||
|
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
|
||||||
|
## Sift
|