Skip to content

tombeom/magugan

Repository files navigation

(한국어 버전으로 가기)


Logo

Magugan

Parking Lot Vacant Slot Information System Using Image Processing

Website · Report Bug · Team members

Table of Contents
  1. About The Project
  2. Getting Started
  3. Contact

About The Project

Our project is about image processing for a parking lot system which keeps count of the available parking spots. It's done with integrated system made of RaspberryPi algorithm and Arduino board ESP32 . The system recognizes the available spots in the parking lot through a camera input that will then be processed by a deep learning image processing algorithm which output is used to monitor the parking lot situation in real time. A live monitoring is shown on a dedicated website which we made with simple CSS and HTML code. ESP32 and RaspberryPI bluetooth communication performs the function of raising and lowering the breaker (which is build with servo-motor) according to the parking lot situation. The information from the parking lot is shown on the website through web server which built on FLASK. The website displays a real-time footage of the parking lot along with the number of parking slots available. The information is updated every 5 seconds.

*Screenshot of real time footage*

IDEs

Thonny Visual Studio Code Arduino

Languages

Python C++ HTML5 CSS3 JavaScript

Frameworks, Platforms and Libraries

Boards

Arduino Raspberry Pi

Deep learning

TensorFlow Keras NumPy

(back to top)

Demonstration video

default.mp4

Getting Started

Prerequisites

Arduino IDE Installed

Before starting this installation procedure, make sure you have the latest version of the Arduino IDE installed in your computer. If you don’t, uninstall it and install it again. Otherwise, it may not work.

Installing ESP32 Add-on in Arduino IDE

To install the ESP32 board in your Arduino IDE, follow these next instructions:

  1. In your Arduino IDE, go to File> Preferences

  1. Enter the following into the “Additional Board Manager URLs” field:

https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

Then, click the “OK” button:

  1. Open the Boards Manager. Go to Tools > Board > Boards Manager…

  1. Search for ESP32 and press install button for the “ESP32 by Espressif Systems“:

(back to top)

ESP32 Wire Connection

(See more)about how the gate works on ESP32

Raspberry Pi Bluetooth communication with ESP32 using PYBLUEZ

  1. Install pybluez for Python3, enter the command in Terminal:
$ sudo pip3 install pybluez
$ sudo apt install bluetooth bluez libbluetooth-dev
  1. Put below python code in Raspberry Pi Thonny.
from bluetooth import *
def sendData():
    print("\nType something\n")
    while True:
        data = input()
        if len(data) == 0: break
        sock.send(data)
        sock.send("\n")           
#MAC address of ESP32
addr = "24:0A:C4:E8:0F:9A"
service_matches = find_service( address = addr )

buf_size = 1024;

if len(service_matches) == 0:
    print("couldn't find the SampleServer service =(")
    sys.exit(0)

for s in range(len(service_matches)):
    print("\nservice_matches: [" + str(s) + "]:")
    print(service_matches[s])
    
first_match = service_matches[0]
port = first_match["port"]
name = first_match["name"]
host = first_match["host"]
port=1
print("connecting to \"%s\" on %s, port %s" % (name, host, port))

# Create the client socket
sock=BluetoothSocket(RFCOMM)
sock.connect((host, port))

print("connected")
sendData()
sock.close()

(back to top)

Installation and Preperation of Detecting object

For this version we have installed RaspberryPi operating system "Buster"

To install Raspberry PI OS Buster on Raspberry Pi Click here

Displaying RaspberryPi

  1. Run below code in the Terminal
$ sudo raspi-config
  1. Set up the Display by following order

Display Options - Resolution - DMT Mode 51

  1. Input below code in order to install OpenCV
$ pip3 install opencv-python==4.5.1.48
  1. Input below code in order to install Numpy
$ pip3 install numpy==1.20.2
  1. Input below code in order to install the required libraries
$ sudo apt-get install libhdf-dev -y
$ sudo apt-get install libhdf-serial-dev -y
$ sudo apt-get install libatlas-base-dev -y
$ sudo apt-get install libjasper-dev -y
$ sudo apt-get install libqtgui4 -y
$ sudo apt-get install libqt4-test -y
  1. Input below code in order to install TensorFlow
$ pip3 install tensorflow==1.14.0
  1. Input below code in order to install Keras
$ pip3 install keras==2.2.5
  • Keras acts as an interface for the TensorFlow library.
  1. Input below code in order to install h5py
$ pip3 install h5py==2.10.0
  • The h5py package is a Pythonic interface to the HDF5 binary data format.

(back to top)

Install Camera Streaming Server

For Camera streaming server we are using mjpg-streamer

Put below codes in the Terminal in order

$ git clone https://github.com/jacksonliam/mjpg-streamer.git
$ cd mjpg-streamer
$ cd mjpg-streamer-experimental
$ sudo apt-get install libjpeg-dev
$ make CMAKE_BUILD_TYPE=Debug
$ sudo make install

After the installation of mjpg-streamer

We have to make shell executable file under name of "mjpg" following code will create the file

sudo nano mjpg.sh

(back to top)

Usage

From the mjpeg streamer folder:

export STREAMER_PATH=$HOME/mjpg/mjpg-streamer/mjpg-streamer-experimental
export LD_LIBRARY_PATH=$STREAMER_PATH
$STREAMER_PATH/mjpg_streamer -i "input_uvc.so" -o "output_http.so -w 
$STREAMER_PATH/www"

** in case if you use raspberrypi camera instead of webcamera follow below lines **

export STREAMER_PATH=$HOME/mjpg/mjpg-streamer/mjpg-streamer-experimental
export LD_LIBRARY_PATH=$STREAMER_PATH
$ STREAMER_PATH/mjpg_streamer -i "input_raspicam.so" -o "output_http.so -w 
$ STREAMER_PATH/www"

Contact

tombeom - tombeom@naver.com
Zolboo - zolboo.oz@gmail.com

Project Link: [https://github.com/tombeom/magugan)

(back to top)

About

Parking lot slot detector using camera

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •