Browse Source

cards2coordinates approaches and found some data

master
corsaronero 1 year ago
parent
commit
9e8da434e5
5 changed files with 2908 additions and 0 deletions
  1. +2848
    -0
      Cards2Coordinates/Berlin/stopsInCoordinatesBerlinUbahn.json
  2. +1
    -0
      Cards2Coordinates/europeTrainStations/stations
  3. BIN
      Cards2Coordinates/openCVGeneralTool/card.jpg
  4. +58
    -0
      Cards2Coordinates/openCVGeneralTool/getCoordinates.py
  5. +1
    -0
      README.md

+ 2848
- 0
Cards2Coordinates/Berlin/stopsInCoordinatesBerlinUbahn.json
File diff suppressed because it is too large
View File


+ 1
- 0
Cards2Coordinates/europeTrainStations/stations

@ -0,0 +1 @@
Subproject commit 807b7ce1d1f028a87274c528c13a3b1c40ae43aa

BIN
Cards2Coordinates/openCVGeneralTool/card.jpg View File

Before After
Width: 4500  |  Height: 3181  |  Size: 1.8 MiB

+ 58
- 0
Cards2Coordinates/openCVGeneralTool/getCoordinates.py View File

@ -0,0 +1,58 @@
# Python code to find the co-ordinates of
# the contours detected in an image.
import numpy as np
import cv2
# Reading image
font = cv2.FONT_HERSHEY_COMPLEX
img2 = cv2.imread('card.jpg', cv2.IMREAD_COLOR)
# Reading same image in another
# variable and converting to gray scale.
img = cv2.imread('card.jpg', cv2.IMREAD_GRAYSCALE)
# Converting image to a binary image
# ( black and white only image).
_, threshold = cv2.threshold(img, 110, 255, cv2.THRESH_BINARY)
# Detecting contours in image.
contours, _= cv2.findContours(threshold, cv2.RETR_TREE,
cv2.CHAIN_APPROX_SIMPLE)
# Going through every contours found in the image.
for cnt in contours :
approx = cv2.approxPolyDP(cnt, 0.009 * cv2.arcLength(cnt, True), True)
# draws boundary of contours.
cv2.drawContours(img2, [approx], 0, (0, 0, 255), 5)
# Used to flatted the array containing
# the co-ordinates of the vertices.
n = approx.ravel()
i = 0
for j in n :
if(i % 2 == 0):
x = n[i]
y = n[i + 1]
# String containing the co-ordinates.
string = str(x) + " " + str(y)
if(i == 0):
# text on topmost co-ordinate.
cv2.putText(img2, "Arrow tip", (x, y),
font, 0.5, (255, 0, 0))
else:
# text on remaining co-ordinates.
cv2.putText(img2, string, (x, y),
font, 0.5, (0, 255, 0))
i = i + 1
# Showing the final image.
cv2.imshow('image2', img2)
# Exiting the window if 'q' is pressed on the keyboard.
if cv2.waitKey(0) & 0xFF == ord('q'):
cv2.destroyAllWindows()

+ 1
- 0
README.md View File

@ -0,0 +1 @@
## die Karte des Rumtreibers

Loading…
Cancel
Save