棄用OCR

This commit is contained in:
2023-04-14 13:35:45 +08:00
parent 094d96cc06
commit de95746dce
2 changed files with 29 additions and 0 deletions

View File

@@ -29,9 +29,29 @@ scp ./main root@47.103.40.152:~/main
## Dev & Install ## Dev & Install
- [gosseract](https://github.com/otiai10/gosseract/tree/v2.2.1)
- [ocrdoc](https://github.com/tesseract-ocr/tessdoc)
- [tesseract-ocr - Tesseract command line OCR tool (devel)](https://launchpad.net/~alex-p/+archive/ubuntu/tesseract-ocr-devel)
```bash ```bash
# ubuntu 安裝 tesseract-ocr
sudo add-apt-repository ppa:alex-p/tesseract-ocr-devel
sudo apt update
sudo apt install tesseract-ocr
sudo apt install libleptonica-dev
sudo apt install libtesseract-dev
# https://i.scwy.net/code/2020/091108-ocr/
sudo apt install tesseract-ocr
sudo apt install libtesseract-dev
sudo apt install tesseract-ocr-chi-sim
tesseract --list-langs
# 需要安装依赖 # 需要安装依赖
sudo apt install libopencv-dev sudo apt install libopencv-dev
``` ```
防止错误 ArucoDetector in namespace cv::aruco does not name a type 防止错误 ArucoDetector in namespace cv::aruco does not name a type

View File

@@ -191,6 +191,15 @@ func main() {
return return
} }
// test ocr
//client := gosseract.NewClient()
//defer client.Close()
//client.SetLanguage("chi_sim")
//client.SetImage("/home/stori/webp/data/tt.jpeg")
//text, _ := client.Text()
//fmt.Println(text)
//fmt.Println("=======================================")
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
defer LogComponent(time.Now().UnixNano(), r) // 最后打印日志 defer LogComponent(time.Now().UnixNano(), r) // 最后打印日志
w.Write([]byte("Hello World!")) w.Write([]byte("Hello World!"))