manual_park.py 文件源码

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

项目:AutonomousParking 作者: jovanduy 项目源码 文件源码
def overlay_img(self):
        """Overlay the transparent, transformed image of the arc onto our CV image"""
        #overlay the arc on the image
        rows, cols, channels = self.transformed.shape
        roi = self.cv_image[0:rows, 0:cols]

        #change arc_image to grayscale
        arc2gray = cv2.cvtColor(self.transformed, cv2.COLOR_BGR2GRAY)
        ret, mask = cv2.threshold(arc2gray, 10, 255, cv2.THRESH_BINARY)
        mask_inv = cv2.bitwise_not(mask)

        #black out area of arc in ROI
        img1_bg = cv2.bitwise_and(roi, roi, mask=mask_inv)
        img2_fg = cv2.bitwise_and(self.transformed, self.transformed, mask=mask)

        #put arc on ROI and modify the main image
        dst = cv2.add(img1_bg, img2_fg)
        self.cv_image[0:rows, 0:cols] = dst
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号