Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

补白边和去除白边的代码会直接卡死 #138

Open
TaceyWong opened this issue May 16, 2024 · 0 comments
Open

补白边和去除白边的代码会直接卡死 #138

TaceyWong opened this issue May 16, 2024 · 0 comments

Comments

@TaceyWong
Copy link

# 如果不是偶数,那么补上白边,Y(明亮度)UV(颜色)

self.img_YUV = cv2.copyMakeBorder(cv2.cvtColor(self.img, cv2.COLOR_BGR2YUV),
                                   0, self.img.shape[0] % 2, 0, self.img.shape[1] % 2,                                   
                                  cv2.BORDER_CONSTANT, value=(0, 0, 0))

# 之前如果不是2的整数,增加了白边,这里去除掉

# 之前如果不是2的整数,增加了白边,这里去除掉
embed_img_YUV = embed_img_YUV[:self.img_shape[0], :self.img_shape[1]]
embed_img = cv2.cvtColor(embed_img_YUV, cv2.COLOR_YUV2BGR)
embed_img = np.clip(embed_img, a_min=0, a_max=255)

追踪到了这两处代码有严重问题(用1100 × 732的图像测试),对cv2这块儿的代码不熟悉,不知道啥情况。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant