Posts

Flow Chart for Car Tracking

Image
Flow Chart for Car Tracking Code: import numpy as np import cv2 import glob import covEX import math import datetime # termination criteria criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001) # prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0) objp = np.zeros((6*8,3), np.float32) objp[:,:2] = np.mgrid[0:6,0:8].T.reshape(-1,2) # Arrays to store object points and image points from all the images. objpoints = [] # 3d point in real world space imgpoints = [] # 2d points in image plane. images = glob.glob('./Calibrate_image/*.jpg') tests = glob.glob('./test_image/*.jpg') samples = glob.glob('./sample_image/*.jpg') w = 1920 h = 1080 cap = cv2.VideoCapture(1) cap.set(3, 1920) cap.set(4, 1080) cap.set(cv2.CAP_PROP_AUTOFOCUS, 0) offset_crop = 15 # Font thickness_val = 1 font_scale_val = 1.5 text_color = (255,255,255) font_face = cv2.FONT_HERSHEY_PLAI...

Flow Chart for OCR Detection

Image
Flow Chart for OCR Detection Code: from picamera.array import PiRGBArray from picamera import PiCamera import socket import sys import cv2 import numpy as np import time import pickle from io import StringIO from multiprocessing.connection import Client import serial front_left = 0 front_center = 0 front_right = 0 back_left = 0 back_center = 0 back_right = 0 compass = 0 speed = 0 i = 0 speed_limit = "50" # Initialize Camera #camera = cv2.VideoCapture(0) camera = PiCamera() camera.resolution = (320, 240) camera.framerate = 90 rawCapture = PiRGBArray(camera, size=(320, 240)) # Create a TCP/IP socket #sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Connect the socket to the port where the server is listening server_address = ('192.168.0.101', 10000) print('connecting to {} port {}'.format(*server_address)) #sock.connect(server_address) client = Client(server_address) ...

Flow Chart for OCR Training

Image
Flow Chart for OCR Training Code: import sys import numpy as np import cv2 import glob images = glob.glob('./train_image/*.jpg') #im = cv2.imread('sign_train.png') #im3 = im.copy() samples =  np.empty((0,100)) responses = [] keys = [i for i in range(48,58)] offset = 2 for fname in images:     im = cv2.imread(fname)     [depth, width, height] = im.shape[::-1]     im_def = im.copy()          ########### Sign Detect New One 2.21     sign_finding = 2.21*im[:,:,2] - im[:,:,1] - im[:,:,0]     sign_finding = np.where(sign_finding > 60, sign_finding, 0)     sign_finding = np.uint8(np.abs(sign_finding))     sign_t,sign_contours,sign_hierarchy = cv2.findContours(sign_finding,cv2.RETR_LIST,cv2.CHAIN_APPROX_SIMPLE)          max_x = 0     max_y = 0     min_x = width     mi...

Complete Camera Mounting

Image
Complete Camera Mounting Camera Mounting After finished design, We go to the wood store and order they to custom made for us. When they delivered we mounted the camera to the middle and used a USB extension cable with USB hub with power plug. The reason that we used USB hub is USB 2.0 have a limit length of cable to 5.0 meters, So we used USB hub as a repeater of signals. The cable is mounted on the wood follow the arm to the top of the cabinet.  Example of image from camera Image from the camera We used Logitech HD Pro Webcam C920 as a camera but FOV of the camera is not enough to cover the track, So we decided to used a wide lens to increase FOV and got a distorted image.

Speed limit sign selector

Image
Speed limit sign selector Speed limit sign We chose this sign pattern as a speed limit sign for our project and this sign used globally.

Camera Mounting Design

Image
Camera Mounting Design Mounting Place 8th floor @SSE Lab TGGS KMUTNB The way to mounting the camera we think we can do it in 2 choices Mount camera to ceiling Create a beam for mount camera So we chose number 2 "Create a bar for mount camera" About beam design Constrain :  Track space is 3m by 3.3m  Floor to ceiling is ~3m Design of beam for mount camera Design of Leg-beam for mount camera