Detecting cars
There is no virtual limit to the type of objects you can detect in your images and videos. However, to obtain an acceptable level of accuracy, you need a sufficiently large dataset, containing train images that are identical in size.
This would be a time consuming operation if we were to do it all by ourselves (which is entirely possible).
We can avail of ready-made datasets; there are a number of them freely downloadable from various sources:
The University of Illinois: http://l2r.cs.uiuc.edu/~cogcomp/Data/Car/CarData.tar.gz
Stanford University: http://ai.stanford.edu/~jkrause/cars/car_dataset.html
Note
Note that training images and test images are available in separate files.
I'll be using the UIUC dataset in my example, but feel free to explore the Internet for other types of datasets.
Now, let's take a look at an example:
import cv2 import numpy as np from os.path import join datapath = "/home/d3athmast3r/dev/python/CarData/TrainImages/" def path(cls,i): return "%s/...