The goal of this assignment is to design and implement algorithms that delineate objects in video images and analyze their shapes.
Method and Implementation
The four fundamental processings .
Connected componets labelling:
--The apporoch is basicly the recursive algorithm provided on the course site.The idea is to traverse the binary image first; then for the first black pixel(object), do the recursive N8 labeling; if one of the N8 has no object piexls, the entire traverse will continue until the end of the image. _____________________________________________________________________________________________
--The moore N8 tracing will suffice this
--Optimize:I used a stack to keep track what pixels is already been labeled as boundary which save a huge mount of time here. _____________________________________________________________________________________________
--I used the moment computing in opencv python library: cv2.moments() which gives the certain image moment:
The area will be the 0th moment.
The centroid which give the information on orentation will be: 1st moment/0th moment
The second moment(a,b,c) will be: 2nd moment/0th moment
The compactness will be: area/perimeter
Example output(for the thumb of a binary hand image):
The area will be: 12223.0
The centroid will be: (78.6393820393, 46.8450598598)
The second moment(a,b,c) will be: (2420.60558969, 671.479825127, 14.2550287452)
The compactness will be:19.6964544394
--The basic approach would be keep computing the furthest pixel for every N8 mask; however this implementation does not work for me; thus I took another approach which will be under the same mask proposition, the dilated version subtract the eroded version of a image will be the skeleton of the image.
--Painist's hand: Absolute threshold specifically on skin color. However the skin theshold here also has a upper bound to prevent the paino key noise(which also happens to be white); specifically for the RGB value, the upper bound will be:
(R less than 150) and (G less than 100) and (B less than 70)
It also requires the ROI setting and the erosion.
--Bats' wing status: I frist used the gaussian adaptive thresholding on the falsecolor image which gives a nice binary image on the contours on every bat; then for every contour (greater then a certain length), compute the circulrity to determine if the wing is folded or spreaded:basicly the rounder the contour, the higher poissiblity the wing will be folded.
--Number of pedestrian: The general idea was like the bats's idea, the only difference is that I only count the contours that has perimeter larger than a certain length (200 in my computation). And also due to this, I can only count the number in the center of the crossroad to avoid other longer perimeter.
|connecting componet labeling|
|Bats' wings status|
|Number of pedestrian|
Credits and Bibliography
--The skeleton code and the VS environment are coming from the second cs585 lab
--The opencv template matching tutorial: http://docs.opencv.org/2.4/doc/tutorials/imgproc/histograms/template_matching/template_matching.html