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

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.

主站蜘蛛池模板: 萝北县| 镇雄县| 太仓市| 东丰县| 札达县| 灵璧县| 建阳市| 比如县| 夹江县| 汝南县| 铜川市| 岳阳市| 察哈| 平陆县| 石屏县| 宜兰县| 金川县| 泸溪县| 桐柏县| 连云港市| 鄂托克前旗| 抚顺县| 漳州市| 铜山县| 木里| 洪江市| 伊金霍洛旗| 山东省| 武威市| 普陀区| 海口市| 彩票| 定南县| 镇雄县| 巧家县| 个旧市| 汕尾市| 莱州市| 恩施市| 巴中市| 浪卡子县|