YaoFANGUK / video-subtitle-remover

基于AI的图片/视频硬字幕去除、文本水印去除,无损分辨率生成去字幕、去水印后的图片/视频文件。无需申请第三方API,本地实现。AI-based tool for removing hard-coded subtitles and text-like watermarks from videos or Pictures.
Apache License 2.0
4.06k stars 527 forks source link

有没有单张图片去除所有文字的方法? #34

Open nissansz opened 8 months ago

nissansz commented 8 months ago

有没有单张图片去除所有文字的方法?

YaoFANGUK commented 8 months ago

这个程序本身就支持 打开图片直接运行就好了

nissansz commented 8 months ago

如果只想处理图片(ppt那种),有没有简化的方法? 得到干净的五字符图片和字符的颜色?

nissansz commented 8 months ago

如果要批量处理一个文件夹下所有图片,用哪个命令行命令可以执行?

YaoFANGUK commented 8 months ago

看源码

nissansz commented 8 months ago

现在是用windows版

nissansz commented 8 months ago

源码运行,输入路径后,运行会报以下错误,没有结果

\video-subtitle-remover-1.1.0\backend>python main.py D:\Python3.8.8\lib\site-packages\setuptools\sandbox.py:13: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html import pkg_resources D:\Python3.8.8\lib\site-packages\pkg_resources__init.py:2868: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('google'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) D:\Python3.8.8\lib\site-packages\pkg_resources__init__.py:2868: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('mpl_toolkits'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) D:\Python3.8.8\lib\site-packages\pkg_resources__init__.py:2868: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('zope'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) D:\Python3.8.8\lib\site-packages\Cython\Distutils\old_build_ext.py:15: DeprecationWarning: dep_util is Deprecated. Use functions from setuptools instead. from distutils.dep_util import newer, newer_group Please input video file path: F:\161.jpg Subtitle Finding: 0%| | 0/1 [00:00<?, ?frame/s][Processing] start finding subtitles... Traceback (most recent call last): File "main.py", line 882, in sd.run() File "main.py", line 791, in run sub_list = self.sub_detector.find_subtitle_frame_no(sub_remover=self) File "main.py", line 84, in find_subtitle_frame_no dt_boxes, elapse = self.detect_subtitle(frame) File "main.py", line 45, in detect_subtitle dt_boxes, elapse = self.text_detector(img) File "L:\detextify\video-subtitle-remover-1.1.0\backend\tools\infer\predict_det.py", line 242, in call post_result = self.postprocess_op(preds, shape_list) File "L:\detextify\video-subtitle-remover-1.1.0\backend\ppocr\postprocess\db_postprocess.py", line 188, in call boxes, scores = self.boxes_from_bitmap(pred[batch_index], mask, File "L:\detextify\video-subtitle-remover-1.1.0\backend\ppocr\postprocess\db_postprocess.py", line 82, in boxes_from_bitmap score = self.box_score_fast(pred, points.reshape(-1, 2)) File "L:\detextify\video-subtitle-remover-1.1.0\backend\ppocr\postprocess\db_postprocess.py", line 140, in box_score_fast xmin = np.clip(np.floor(box[:, 0].min()).astype(np.int), 0, w - 1) File "D:\Python3.8.8\lib\site-packages\numpy__init.py", line 305, in getattr raise AttributeError(former_attrs[attr]) AttributeError: module 'numpy' has no attribute 'int'. np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations Subtitle Finding: 0%| | 0/1 [00:01<?, ?frame/s] Subtitle Removing: 0%| | 0/1 [00:01<?, ?frame/s]

nissansz commented 8 months ago

源码运行,python gui.py, 选择路径后,选择全屏尺寸,运行会报以下错误,没有结果

Open Video Success:F:/161.jpg SubtitleArea:(0,300,0,2306) [Processing] start finding subtitles... Exception in thread Thread-3: Traceback (most recent call last): File "D:\Python3.8.8\lib\threading.py", line 932, in _bootstrap_inner self.run() File "D:\Python3.8.8\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "gui.py", line 277, in task self.sr.run() File "L:\detextify\video-subtitle-remover-1.1.0\backend\main.py", line 791, in run sub_list = self.sub_detector.find_subtitle_frame_no(sub_remover=self) File "L:\detextify\video-subtitle-remover-1.1.0\backend\main.py", line 84, in find_subtitle_frame_no dt_boxes, elapse = self.detect_subtitle(frame) File "L:\detextify\video-subtitle-remover-1.1.0\backend\main.py", line 45, in detect_subtitle dt_boxes, elapse = self.text_detector(img) File "L:\detextify\video-subtitle-remover-1.1.0\backend\tools\infer\predict_det.py", line 242, in call post_result = self.postprocess_op(preds, shape_list) File "L:\detextify\video-subtitle-remover-1.1.0\backend\ppocr\postprocess\db_postprocess.py", line 188, in call boxes, scores = self.boxes_from_bitmap(pred[batch_index], mask, File "L:\detextify\video-subtitle-remover-1.1.0\backend\ppocr\postprocess\db_postprocess.py", line 82, in boxes_from_bitmap score = self.box_score_fast(pred, points.reshape(-1, 2)) File "L:\detextify\video-subtitle-remover-1.1.0\backend\ppocr\postprocess\db_postprocess.py", line 140, in box_score_fast xmin = np.clip(np.floor(box[:, 0].min()).astype(np.int), 0, w - 1) File "D:\Python3.8.8\lib\site-packages\numpy__init.py", line 305, in getattr raise AttributeError(former_attrs__[attr]) AttributeError: module 'numpy' has no attribute 'int'. np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations