diff --git a/README.md b/README.md index 8cf3240..a325b86 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,29 @@ scp ./main root@47.103.40.152:~/main ## 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 +# 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 + ``` 防止错误 ‘ArucoDetector’ in namespace ‘cv::aruco’ does not name a type diff --git a/bin/main.go b/bin/main.go index 92b70c5..bcf8873 100644 --- a/bin/main.go +++ b/bin/main.go @@ -191,6 +191,15 @@ func main() { 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) { defer LogComponent(time.Now().UnixNano(), r) // 最后打印日志 w.Write([]byte("Hello World!"))