Tools for scanning tire tread(s).
Project description
treadscan
This package provides utilities for extracting tire tread (pattern) from images, or even from video of passing cars.
Three main classes are
treadscan.Detector
- picks out stopped cars from continoous footage (like at an intersection, under a traffic light).
treadscan.Segmentor
- finds ellipse defining car wheel in image (using image segmentation techniques).
treadscan.Extractor
- creates a tire model from the ellipse, then "unwraps" the tire tread (or rather part of the tire tread, as only about a quarter of the tread is visible).
There are 3 different ways to detect car wheels in image. Only treadscan.Segmentor
is included in the treadscan
package and works out of the box. This class has a major downfall and that is that it only has a chance to work correctly if the car in the image has very bright rims, which contrast enough with the tire. There is also treadscan.RCNNSegmentor
which uses a region based convolutional neural network to find the car wheel in image but the treadscan
package doesn't include a pre-trained model. You can however use the model included in this repository or even train your own.
Before training a model, you need annotated training data. To annotate images, you can use the model_annotation.py
, which conveniently saves the keypoints and bounding boxes as a JSON in the same format as used in the training notebook. This script is included in this folder.
This GUI utilises the OpenCV window, using mouse position and keyboard input to place the points. So to place a point, user can hover over a location and press a specific key, or hold the key while dragging with the mouse. The points which have to be placed manually are:
T
- top of vehicle's rimB
- bottom of vehicle's rimR
- third point on the rim (best to always use the same location)S
- sidewall height (recommended location is above theT
point)W
- inner side of tire
Other controls are:
SPACEBAR
- show a preview of tire treadBACKSPACE
- hide tread previewN
- submit keypoints, keep annotating (you might wish to annotate ALL tires in image if there are multiple)ENTER
- to export keypoints to JSON fileESCAPE
- quit annotation without exporting
The 5 keypoints are used to construct tire bounding ellipses, between which lies the tire tread. Once the Keypoint-RCNN has learned them, it can be used to make automated predictions, thus finding the tire location in images automatically.
Another option is to find the location of the tire manually using a GUI script, manual_annotation.py
.
The controls are:
T
- top of vehicle's rimB
- bottom of the vehicle's rimR
- right (or left) side
These 3 points form an ellipse, which defines the location of vehicle's rim in image (red ellipse in the above image). Then the tire model is extrapolated from that, or can be further modified using the optional points:
O
- move outer tire ellipse (left yellow ellipse)S
- tire sidewall height (height of yellow ellipses)W
- tire width (move inner tire ellipse, right yellow ellipse)U
- top of tread extraction (starting angle, top of green rectangle)I
- bottom of tread extraction (ending angle, bottom of green rectangle)
Pressing SPACEBAR
shows preview of extracted tread, BACKSPACE
hides this preview. Pressing ENTER
saves full size extracted tread as new image. Closing the window or pressing ESCAPE
closes the window.
Additionally the treadscan_script.py
in the extras
folder can process footage (folder of images/video/stream) and extract the tread of each car from the footage. It has 3 modes: manual (user annotates each manually), semiauto (user annotates only those where Segmentor fails) and auto (images where Segmentor fails are discarded). Extracted treads are saved to a folder.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file treadscan-0.7.tar.gz
.
File metadata
- Download URL: treadscan-0.7.tar.gz
- Upload date:
- Size: 28.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96b1e4a4b67beae331aebfbbb703810e43980bf1d8a8f7f8ed46f5f7ff717e5c |
|
MD5 | 9a601e74233084cdcf263d0afd10fea0 |
|
BLAKE2b-256 | bce5e278cdb190e628b5b8e7561b233a7b6a33ab60a2e6d7c182fa5c9cd8d9e8 |
File details
Details for the file treadscan-0.7-py3-none-any.whl
.
File metadata
- Download URL: treadscan-0.7-py3-none-any.whl
- Upload date:
- Size: 28.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfc6344c50e4ff433b1c230ac818812bdcac3c300a931b9d5f7d3d10178ddac2 |
|
MD5 | f3ea8b2f65a70aed6e3b150eaf446dbb |
|
BLAKE2b-256 | ab4b9dfa0eb8b3e31990b3dbe2aed18e818e25deaaf6054a5f702a65cef57b41 |