piwall.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:piwall-cvtools 作者: infinnovation 项目源码 文件源码
def mapit(self, mode):
        # Find the centroid of the bounding box of the image (we know this by construction - testing the functions)
        w,h,c = self.img.shape
        outerEdge = np.array([(0,0), (0, h), (w,h), (w, 0)], dtype = np.int)
        M = cv2.moments(outerEdge)
        cX = int(M["m10"] / M["m00"])
        cY = int(M["m01"] / M["m00"])
        cv2.circle(self.img, (cX, cY), 7, (255, 255, 255), -1)
        cv2.putText(self.img, "center", (cX - 20, cY - 20),
                    cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)
        cv2.rectangle(self.img, (cX-30, cY-30), (cY+30, cY+30),(0,255,0), 2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号