Hardware Reference
In-Depth Information
5.
We will extract the features of the image using the
canny edge detecion
technique.
Since the informaion is prone to noise, we use the smoothing technique to
eliminate the noise in the image:
cv.Canny(gray,edges,200,100,3)
cv.Smooth(gray,gray,cv.CV_GAUSSIAN,3,3)
6. We will atempt to detect the dishes using common shapes found in the dishes.
The technique is called
Hough transforms
and we will try to detect circular objects
in the image:
storage = cv.CreateMat(640,1,cv.CV_32FC3)
cv.HoughCircles(gray,storage,cv.CV_HOUGH_GRADIENT,1,30,100,55,0,0)
7. We will draw a circle around each object detected. This helps in eliminaing any
incorrect object detecion:
for i in range(storage.rows ):
val = storage[i, 0]
vessels = vessels + 1 #increment dishes detected by 1
radius = int(val[2])
center = (int(val[0]), int(val[1]))
cv.Circle(im, center, radius, (0, 0, 255), 3, 8, 0)
8. The objects detected can be viewed as follows:
Dishes detected in OpenCV
9. If a vessel is detected, we will trigger an LED alert to annoy the user.