DisparityComputer.py 文件源码

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

项目:img2d3d_segmentation 作者: psodhi 项目源码 文件源码
def leftRightHistEqualize(self, img_left, img_right) :

        lookup = np.zeros([256], np.uint8)
        cdf_new = np.zeros([256])
        rows,cols = img_right.shape
        img_left_new = np.zeros([rows,cols], np.uint8)

        hist_left = cv2.calcHist([img_left],[0],None,[256],[0,255])
        hist_right = cv2.calcHist([img_right],[0],None,[256],[0,255])
        cdf_left_norm = hist_left.cumsum() /(rows*cols)
        cdf_right_norm = hist_right.cumsum() /(rows*cols)

        for i in range(0,256):
            lookup[i] = np.argmin(np.abs(cdf_left_norm[i]-cdf_right_norm))
            # cdf_new[i] = cdf_right_norm[lookup[i]]
            img_left_new[ np.where(img_left==i) ] = lookup[i]

        return img_left_new
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号