官术网_书友最值得收藏!

Finding the convex hull of a contour area

Once we have identified the largest contour in our mask, it is straightforward to compute the convex hull of the contour area. The convex hull is basically the envelope of the contour area. If you think of all the pixels that belong to the contour area as a set of nails poking out of a board, then a tight rubber band encircles all the nails forming the convex hull shape. We can get the convex hull directly from our largest contour (max_contour), like this:

hull = cv2.convexHull(max_contour, returnPoints=False) 

As we now want to look at convexity deficits in this hull, we are instructed by the OpenCV documentation to set the returnPoints optional flag to False.

The convex hull drawn in yellow around a segmented hand region looks like this:

As mentioned previously, we will determine a hand gesture based on convexity defects. Let's move on and learn how to find the convexity defects of a convex hull in the next section, which will bring us one step closer to recognizing hand gestures.

主站蜘蛛池模板: 蒲城县| 广平县| 安达市| 纳雍县| 南雄市| 淮北市| 喀喇| 曲靖市| 泗洪县| 嘉黎县| 冷水江市| 建宁县| 克山县| 沙湾县| 阳春市| 韩城市| 静乐县| 霍林郭勒市| 利辛县| 县级市| 盱眙县| 营山县| 宝坻区| 平和县| 贺州市| 潼关县| 定结县| 新竹市| 阿荣旗| 吉林省| 铜陵市| 鹤岗市| 通许县| 阳西县| 竹溪县| 大方县| 伊宁县| 丰宁| 遵义县| 丹江口市| 北安市|