
如题,希望用程序把已有的视频做个标记,方便展示
1 3dwelcome 2021 年 4 月 23 日 via Android 把两边屏幕的部分裁剪下来,用 fft 2d 进行运算,画面是不是模糊处理过,频域空间一看便知。 |
2 bqbkbz 2021 年 4 月 24 日 via Android |
3 enzoyang OP 谢谢大家的提示,我试验了一下,边缘检测加判断图中竖直的边缘应该够用了 ``` def detect_horizontal_edges(cv_img) -> list: """找出图片中的竖线边界""" if isinstance(cv_img, str): cv_img = cv2.imread(cv_img) # 转成灰度 gray_img = cv2.cvtColor(cv_img, cv2.COLOR_BGR2GRAY) # 边缘检测 canny = cv2.Canny(gray_img, 20, 100) # 加粗边缘 kernal = cv2.getStructuringElement(cv2.MORPH_RECT, (2, 2)) dilated = cv2.dilate(canny, kernal) # 判断竖线 h, w = dilated.shape[0], dilated.shape[1] threshold = int(h * 0.75) edge_positiOns= [] for x in range(w): white_dots = 0 for y in range(h): if dilated[y, x] == 255: white_dots += 1 if white_dots > threshold: edge_positions.append(x) return edge_positions ``` |
4 enzoyang OP 应该是 detect_vertical_edges,代码里弄混了 |
5 julyclyde 2021 年 5 月 8 日 腾讯在这方面好像有个专利 |