Python 使用 EasyOCR检测图片是否有文字
检测图片是否有文字:
EasyOCR 对 中文、手写字体、复杂背景 处理更好。
github 地址:https://github.com/JaidedAI/EasyOCR
安装:
pip install easyocr
model 相关安装包
1,模型的官方地址:
https://www.jaided.ai/easyocr/modelhub/
2,官方站的下载很慢,我转存到了百度网盘,链接:
https://pan.baidu.com/s/13VsP9RbbTEguJtCl812XEA?pwd=lstn
提取码:lstn
import easyocr def has_text_easyocr(image_path): reader = easyocr.Reader(['ch_sim', 'en']) # 支持中文和英文 result = reader.readtext(image_path) return len(result) > 0 # 只要检测到文字区域,就认为有文字 # 测试 image_path = "test.jpg" if has_text_easyocr(image_path): print("图片上有文字") else: print("图片上没有文字")
 
                    
                     
                    
                 
                    
                 
                
            
         
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号