# Build OpenCV with Tesseract

**URL:** <https://forum.opencv.org/t/build-opencv-with-tesseract/6410>\
**Category:** Uncategorized\
**Tags:** build\
**Created:** [November 24, 2021, 1:24pm UTC](https://forum.opencv.org/t/build-opencv-with-tesseract/6410 "2021-11-24T13:24:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahdi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mahdi/32/3459_2.png) [@Mahdi](https://forum.opencv.org/u/Mahdi)\
**Post date:** [November 24, 2021, 1:24pm UTC](https://forum.opencv.org/t/build-opencv-with-tesseract/6410/1 "2021-11-24T13:24:44Z")

</div>

hi, I want to build opencv-4.5.4 + Tesseract-5 with cmake

[img1]

 ![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/e/eed9fd01b13810a84e1f882c0003af110ad07d81.png)

**(1)** i downloaded this file (64 bit) :  
[Binaries](https://tesseract-ocr.github.io/tessdoc/Home.html#binaries) \> [Tesseract installer for Windows](https://github.com/UB-Mannheim/tesseract/wiki#tesseract-installer-for-windows) \> [tesseract-ocr-w64-setup-v5.0.0-rc1.20211030.exe](https://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-w32-setup-v5.0.0-rc1.20211030.exe)  
but i don’t know how set these 3 inputs [see img1] :

1. Tesseract\_DIR
2. Tesseract\_INCLUDE\_DIR
3. Tesseract\_LIBRARY

[img2]

 ![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/a/a73a0df5b00152e606991256397b4cbf61c311b8.png)

**(2)** i went to this link [[Compilation guide for various platforms](https://tesseract-ocr.github.io/tessdoc/Compiling.html#windows) ] and build tesseract from this method [[For visual studio project using tesseract](https://tesseract-ocr.github.io/tessdoc/Compiling.html#for-visual-studio-project-using-tesseract) ] —\> after build end —\> this is result :

[img3]

 ![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/2/2eccf616db96747b34810d9c063c2458cb33be78.png)

i set these 3 inputs [see img1] like this :

1. Tesseract\_DIR :  
empty!
2. Tesseract\_INCLUDE\_DIR :  
C:\Users\mahdi\vcpkg\installed\Tesseract-x64-windows\include
3. Tesseract\_LIBRARY :  
C:\Users\mahdi\vcpkg\installed\Tesseract-x64-windows\lib

after press configure button [in cmake] → i saw Tesseract not installed! :

 ![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/4/4011e405344aa309c587c3d5a2a2104fcd4dcccf.png)

How can I solve this problem? I want to build opencv with Tesseract but I can’t ☹

---

<div class="post-metadata">

**Author:** ![Mahdi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mahdi/32/3459_2.png) [@Mahdi](https://forum.opencv.org/u/Mahdi)\
**Post date:** [November 24, 2021, 3:22pm UTC](https://forum.opencv.org/t/build-opencv-with-tesseract/6410/2 "2021-11-24T15:22:26Z")

</div>

k i found answer 😑  
i added tesseract paths to Environment Variables :

 ![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/4/4e4b4adddcc0012fa1b7814bb4c79a18b10b5ce4.png)

Then I restarted cmake, Then I deleted [cleaned] these 3 inputs [see img1]  
then press Configure button in cmake, Tesseract found! 😑

 ![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/d/d6f0e48fd099353bd3055b1c43272a47d5e03cd8.png)
