Skip to content

Commit

Permalink
Merge pull request #2 from dpozimski/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
dpozimski authored Apr 17, 2018
2 parents 4a8a967 + 430bf7e commit 51c58b1
Show file tree
Hide file tree
Showing 17 changed files with 59 additions and 9 deletions.
15 changes: 15 additions & 0 deletions LicensePlateCharsExtractor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Recognition of license plates in the picture

The project is responsible for finding license plates in the pictures from the parking lot

1. The image is converted to shades of gray
2. By thresholding, we make a stamp from the photo (threshold). Then we can find and mark contours and detect geometrical figures in the picture.
3. Then, search for license plate contours and their verification:
- remove the contours located at the image edge
- search for contours with 4 vertices
- check if the angles between the straight lines are within the given range
- check the straight lines proportions
4. We create a mask based on the received vertices and cut the license plate from the picture. We get a vector describing the license plate
5. We rotate the license plate to get the shape of a rectangle
6. We cut 20 pixels from the left to remove the blue bar from license plate
7. Using a separate application, we created a model table for the neural network learning
19 changes: 19 additions & 0 deletions ParkingSystem/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Smart automated parking payment system

Business application which detects license plates with image processing, basing on photos taken by a camera installed under the entrance barrier.
Application communicates with opencv program sending photo to C++ project.
It returns license plate.
Information is saved in the database and there are windows alerts about events assigned to the section.

Application send communication about car's arrive.
Arrival time is saved in database with read license number.
In logs there is an information about parking beginning - it is flagged with a green arrow.
In the case of sending the same photo to the database, driver gets an e-mail about costs from wp.pl domain.
Meanwhile in logs there is an information about end of parking - it is flagged with a red arrow.
Parking time is calculated from car's arrive to departure. Cost is 3 PLN per 1 hour.

Technologies:
1. WPF - graphical subsystem which renders application window.
2. Server which listens on port 12358 for all post requests with photos in .jpg format.
3. Application communicates with opencv project using proxy.
4. SQLite database using Entity Framework
2 changes: 1 addition & 1 deletion ParkingSystem/RestServer/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Server : IDisposable

public void Start()
{
server = new RESTServer();
server = new RESTServer(port: "12358");
server.Start();

if(!server.IsListening)
Expand Down
8 changes: 6 additions & 2 deletions ParkingSystem/UI/Utils/Toaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Hardcodet.Wpf.TaskbarNotification;
using ParkingSystem.UI.ViewModels.Core;
using ParkingSystem.UI.Views.Core;

namespace ParkingSystem.UI.Utils
{
Expand All @@ -13,8 +15,10 @@ public static class Toaster
public static void Show(ShellViewModel rootVm, string message)
{
var icon = BalloonIcon.Info;
rootVm.HWND.Dispatcher.BeginInvoke(new Action(() =>
rootVm.HWND.TaskbarIcon.ShowBalloonTip("ArcadiaSync", message, icon)));
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
((Shell)Application.Current.MainWindow).TaskbarIcon.ShowBalloonTip("ParkingSystem", message, icon);
}));
}
}
}
2 changes: 0 additions & 2 deletions ParkingSystem/UI/ViewModels/Core/ShellViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public DateTime Now
get { return DateTime.Now; }
}

public Shell HWND { get; set; }

public ShellViewModel()
{
InitTimer();
Expand Down
10 changes: 8 additions & 2 deletions ParkingSystem/UI/ViewModels/LogsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
using ParkingSystem.ImageHandlerWorker;
using ParkingSystem.DriversRepository.DAL;
using ParkingSystem.UI.Utils;
using System.Windows;

namespace ParkingSystem.UI.ViewModels
{
public class LogsViewModel : ViewModelBase
public class LogsViewModel : ViewModelBase, IDisposable
{
private LogsDAL _logsDal;
private WorkerFacade _workerFacade;
Expand All @@ -39,7 +40,7 @@ private void OnNumberPlateArrived(object sender, NumberPlateEventArgs e)
{
var vm = new LogViewModel(e.Log);

RootViewModel.HWND.Dispatcher.BeginInvoke(new Action(() =>
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
Logs.Add(vm);

Expand All @@ -49,5 +50,10 @@ private void OnNumberPlateArrived(object sender, NumberPlateEventArgs e)
$"{e.Owner.FirstName} {e.Owner.LastName} {e.Owner.NumberPlateNumber} needs to pay {e.Price.Value.ToString("N2")} PLN");
}));
}

public void Dispose()
{
_workerFacade.Dispose();
}
}
}
2 changes: 1 addition & 1 deletion ParkingSystem/UI/Views/Core/Shell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</TabItem>

<TabItem Header="Logs">
<views:LogsView>
<views:LogsView x:Name="LogsView">
<views:LogsView.DataContext>
<vm:LogsViewModel />
</views:LogsView.DataContext>
Expand Down
8 changes: 7 additions & 1 deletion ParkingSystem/UI/Views/Core/Shell.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using MahApps.Metro.Controls;
using System.Drawing;
using ParkingSystem.UI.ViewModels.Core;
using System.ComponentModel;
using System;

namespace ParkingSystem.UI.Views.Core
{
Expand All @@ -12,8 +14,12 @@ public partial class Shell : MetroWindow
public Shell()
{
DataContext = new ShellViewModel();
(DataContext as ShellViewModel).HWND = this;
InitializeComponent();
}

protected override void OnClosing(CancelEventArgs e)
{
(LogsView.DataContext as IDisposable).Dispose();
}
}
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# ai-parking-system
Parking system with number plate recognition using neural network.

[![Watch the video](http://github.com/dpozimski/ai-parking-system/tree/develop/Resources/application.jpg)](http://www.youtube.com/watch?v=uCqBg6iALBg&feature=youtu.be)
Binary file added Resources/application.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed TestData/L2.jpg
Binary file not shown.
Binary file removed TestData/L3.jpg
Binary file not shown.
Binary file removed TestData/P3.jpg
Binary file not shown.
Binary file removed TestData/test1.png
Binary file not shown.
Binary file removed TestData/test2.png
Binary file not shown.
Binary file removed TestData/test3.jpg
Binary file not shown.
Binary file added Videos/video-1523106872.mp4
Binary file not shown.

0 comments on commit 51c58b1

Please sign in to comment.