# Spottr

![](https://user-images.githubusercontent.com/66564001/219960018-a2ace7c3-08f8-4a07-b6c2-eb37554feeb1.png)

Navigate with ease, locate open spots quickly, and get notified about busy lots. Find parking stress-free, save time, and reduce carbon emissions with our parking lot tracker. Join us in creating a greener future, one parking spot at a time.

## Inspiration

As college students, we encountered the *challenge of finding parking* on a daily basis, which often made us late for class. We realized that not only does circling parking lots *waste time*, but it also contributes to *carbon emissions* from excessive driving. To address this issue, we developed Spottr, a **sustainable solution** that minimizes *carbon footprint and optimizes transportation* by providing real-time parking information. By helping *drivers find the available open parking spots* from the moment they enter their car, we aim to *reduce time wasted* and promote *sustainable transportation* practices.

## What it does

Our innovative technology uses real-time footage to accurately label available parking spots and present the information to the user in real-time. By eliminating the need for sensors, we provide a cost-effective and efficient solution for drivers. With Spottr, you'll never have to waste time circling parking lots again, and you'll be contributing to a greener planet.

## Walkthrough

* **Starting Page**
	+ The program starts and a pop-up window appears.



![](https://user-images.githubusercontent.com/66564001/219957899-cf8a1ee8-694d-4156-bcd4-43f106667989.png)

* **Learn More**
	+ It gives you a brief description of what Spottr does.



![](https://user-images.githubusercontent.com/66564001/219958171-8429df7c-6579-4717-96f8-e6a40b912750.png)

* **Try Out!**
	+ It gives you option to select from:



![](https://user-images.githubusercontent.com/66564001/219960407-04b049f0-6684-48b7-9bc5-70f57726816f.PNG)

* **Parking Spot Detection**
	+ It detects all the spot that are available and marks them as green while others red.



![](https://user-images.githubusercontent.com/66564001/219960475-3b821d0c-c0c0-4416-85cb-46129fafe573.PNG)

## How we built it

* **Data Collection**
	+ Our system requires video footage of parking lots from a top/bird's-eye view.
	+ We conducted an internet search to find the necessary videos for our project.
* **Reading The Videos**
	+ We utilized the OpenCV library to read, write, and display the videos.
	+ We created two Python files, 'ParkingSpaceMarker.py' and 'main.py'.
* **Area of Interest(ParkingSpaceMaker.py)**
	+ As running a for-loop was inconvenient due to irregular spacing in the parking lots, we manually marked the spots using rectangular boxes.
	+ We then stored these coordinates in a binary file for 'main.py' to utilize and mark the spots on the video.
* **Image Processing(Main.py)**
	+ We read the binary file and marked the parking spots as empty or occupied on the video.
	+ To increase focus and reduce distractions, we converted the RGB image to grayscale.
	+ We applied Gaussian blur to reduce visual noise such as shadows and reflections and to detect the edges of the parking spots more accurately.
	+ We then used adaptive thresholding to segment the foreground and background and create a binary image based on pixel intensity due to poor lighting conditions in the footage.
	+ We applied median blur to further smooth the image and reduce salt-and-pepper noise.
	+ We used dilation to fill small gaps and reduce the risk of false negatives.
	+ Finally, we counted the number of non-zero pixels in the binary image to determine which parking spots were occupied or available.
* **User Experience**
	+ We utilized the tkinter library to create a more user-friendly interface instead of command-line interaction.

## Challenges we ran into

* Finding suitable video footage of parking lots from a top/bird's-eye view was challenging.
* Marking the parking spots manually was time-consuming and required careful attention to detail due to irregular spacing in the parking lots.
* Poor lighting conditions in the video footage made it difficult to accurately segment the foreground and background using adaptive thresholding.
* The presence of salt-and-pepper noise in the image created distractions and made it challenging to accurately detect parking spot occupancy.
* Identifying a suitable threshold value for counting non-zero pixels in the binary image was challenging and required experimentation.

## Accomplishments that we're proud of

* Successfully created a functional prototype of Spottr that can accurately detect parking spot occupancy in real-time.
* Designed a user-friendly interface using tkinter that allows for easy interaction and visual feedback.
* Optimized the image processing pipeline to minimize processing time while maintaining accuracy.
* Developed a sustainable solution to minimize carbon footprint and promote sustainable transportation practices by reducing the time wasted on circling parking lots.
* Addressed a common problem faced by college students by providing a convenient and efficient solution for finding parking spots.

## What we learned

* Learned the importance of careful planning and attention to detail when dealing with complex image processing tasks.
* Gained proficiency in using the OpenCV library for image processing tasks.
* Improved problem-solving skills by addressing challenges that arose during the development process.
* Gained experience in software development, specifically in developing a functional prototype from ideation to implementation.
* Learned the importance of sustainable transportation practices and the role technology can play in promoting such practices.

## What's next for Spottr

Spottr is a sustainable solution that minimizes carbon footprint and optimizes transportation by providing real-time parking information. Our next step is to integrate Spottr with Google Maps, offering a more comprehensive solution to parking-related problems. With the premium subscription model, we aim to be the go-to solution for finding parking spots in urban areas.
## Inspiration

We wanted to try some new tech. Gain more experience. Learn as much as we could for our first hackathon.
Pebble seemed like the way to go.
We wanted to build an app for the Pebble smartwatch that takes advantage of its fitness capabilities. We also know that we are way more likely to commit (a follow through) to a workout if you have a friend with you, but sometimes it isn't always feasible to run with other people in the same location. We intended this app to let you virtually run with your friends (a race!).

## What it does

This app was designed to track your speed, and distance as you run. If you chose, you can "run with a friend". This app was supposed to collect real time data for both you and your friend. On your screen you would see your stats for the run as well as your friends; allowing for a race between the two of you without your friend being physically with you.

## How we built it

Built mainly in cloudpebble, tested with two pebble devices and android smartphones.

## Challenges we ran into

We had a lot of difficulty working with the gps and using that to find the distance traveled (we found it was not accurate enough). We also struggled with integrating the script written in the pebble java-script environment with the android side of the development (which was supposed to handle the data transfer between you and your friend).

## Accomplishments that I'm proud of

How fast we learned and our perseverance - sticking with a project and trying different strategies to accomplish a problem. A lot (understatement) of problem solving was involved.

## What I learned

Learned javascript, Android Studio, cloudpebble, pebble.js, and a whole lot of teamwork. We learned that pebble development has many facets, and although C is tougher, it makes integration easier and allows far more doors to be opened. We learned how complicated android app development can quickly become, and that simple solutions are a developers best friend.

## What's next for Running Together

The next step for Running Together is to create a catchy one word name like Facebook or Twitter. Also we need to add many core features and implement actual real time data. Finally, we need way more flashy features and microtransactions to keep the loyal user base hooked.
## Inspiration

We aimed to build smart cities by helping garbage truck drivers receive the most efficient route in near-real-time, minimizing waste buildup in prone areas. This approach directly addresses issues of inefficiency in traditional waste collection, which often relies on static daily or weekly routes.

You might be wondering, why not just let drivers follow standard routes? In densely populated areas, waste accumulates faster than in less populated zones. This means that a one-size-fits-all route approach leads to inefficient pickups, resulting in garbage buildup that contributes to air and water pollution. By targeting areas where waste accumulates more quickly, we can reduce contamination, improve air quality, and create greener, healthier environments. Additionally, optimizing waste collection can lead to more sustainable use of resources and reduce the strain on landfills.

## What it does

CleanSweep has sensors that collect real-time information about all the trash cans in the city, detecting different waste levels. This data is live-updated in the truck drivers' main portal while they drive, allowing them to receive the most efficient collection routes. These routes are optimized based on real-time data, including the percentage of trash bin capacity filled, traffic conditions between bins, and the number of days since the last pickup. As drivers collect trash, they can update their progress live to receive the next optimized route for the remaining bins.

## How we built it

For our hardware: We used two phone cameras in two similar scenarios that sent photos repeatedly to a computer. This image is then passed onto the Raspberry Pi where Python OpenCV was used to detect the trash level filled. Then a Node.JS script was used to display the levels (1 to 5) on a set of LEDs and then pass the information to a local server for further processing on the software side.

Backend: We received the reported trash level data from the hardware, information about the traffic in the surrounding vicinity as well as distance to the bin from the Google Maps API and Google Distance Matrix API, and pre-modeled values for time since last garbage retrieval and fed this into a Random Forest Classifier model on Databricks. Our model makes predictions on how to prioritize the bin routes in order to get a short path and distance–resulting in fewer emissions. An adjacency matrix was then used to retrieve the highest priority paths based on traffic and waste levels.

Frontend: We used React for the UI and TailwindCSS for styling to create the portal, deployed over Terraform. We brought all of this information together to display the recommended optimal routes based on how full the bins were (which can be changed by adding more trash to bin 1 and 2 in real life).

## Challenges we ran into

Measuring the level of the trash bin was actually a very challenging task for what seemed like a simple task. We first tried looking for pre-trained models that could do it for us, but other models only worked with object tracking. We went to OpenCV, but that only worked in certain conditions. Thus, one of the hardest challenges we experienced was making sure the lighting conditions, the setup for the cameras and hardware, and our OpenCV contour algorithm worked deterministically, as even a shadow could mess with our results.

## Accomplishments that we're proud of

None of us had ever worked with OpenCV or with using hardware at a hackathon. We wanted to take some of the skills we learned in our electrical classes and implement them with a cool solution, even if it was a bit tacky. We were super proud of learning how OpenCV worked and how we could use hardware as well as a network to create a complete interactive solution. Another major component of this hackathon was hardware as we’ve always wanted to use such a concept to visualize our project and make it easier to understand for everyone on what our goals are. We enjoyed our varied skills by stepping out of our comfort zone and using new technologies; each member used a new skill to implement in the project.

## What we learned

All of us learned about the parts of networks and hardware required to communicate including the security standards and communication frequency needed to keep all the data real time. We learned how to build a working website with a login system through the use of react and vite, as well as implementing the Google maps API for visualizing the route for the drivers. We also learned how GPIO works on a raspberry pi and how a simple JS script can control the power output for these pins to control LEDs. Another skill we found interesting was the use of OpenCV for image processing as it made computing the percentage a task of a second rather than a longer time of manual image processing algorithms. Finally, we were able to start using an ML model to train and help us find the best routes for drivers, this resulted in faster travel times as traffic was avoided and garbage collection optimized.

## What's next for Clean Sweep

Clean Sweep’s next goals would be to implement real time sensors in bins spread out all over the city to collect data and help train the model by providing the large amounts of data. This would then help implement this real time UI to efficiently visit all the necessary stops for the day. Such a system would also allow for coverage over rare cases such as a garbage truck missing a stop or allowing other trucks to take over a broken truck’s schedule as the route would update in real time to collect all garbage fast and efficiently.