In my project I have to read the numbers from the image(.jpg or .tiff). After googling a lot, I came to know about the open OCR i.e., Tesseract OCR. Am begginer for Tesseract OCR, I read all the documentation of tesseract & how to use it in Visual studio. Bascically am facing some problem in using tesseract... I followed the steps like this:
1) Downloaded & Installed tesseract-ocr-setup-3.02.02.exe from http://code.google.com/p/tesseract-ocr/downloads/detail?name=tesseract-ocr-setup-3.02.02.exe
2)Open up Microsoft Visual Studio 2008 and go to Tools -> Options
Project solutions -> VC++ Directories -> Show directories for include files
Add:
C:\Program Files\Tesseract-OCR\include
C:\Program Files\Tesseract-OCR\include\tesseract
C:\Program Files\Tesseract-OCR\include\leptonica
3) Next click show directories for -> Library Files
Add:
C:\Program Files\Tesseract-OCR\lib
4) Configure linker options for Tesseract
Right click your project in solution explorer and click properties
Configuration Properties -> Linker->Input ->Additional Dependencies
Add this in there:
libtesseract302.lib
libtesseract302d.lib
liblept168.lib
liblept168d.lib
5) Copy liblept168.dll, liblept168d.dll, libtesseract302.dll and libtesseract302.dll from C:\Program Files\Tesseract-OCR\ into your project folder
6) main.cpp source file looks like this :
#include<baseapi.h>
#include <allheaders.h>
#include <iostream>
using namespace std;
int main(void){
tesseract::TessBaseAPI api;
api.Init("", "eng", tesseract::OEM_DEFAULT);
api.SetPageSegMode(static_cast<tesseract::PageSegMode>(7));
api.SetOutputName("out");
cout<<"File name:";
char image[256];
cin>>image;
PIX *pixs = pixRead(image);
STRING text_out;
api.ProcessPages(image, NULL, 0, &text_out);
cout<<text_out.string();
}
The problem is am unable to compile this code.. Am getting linker error i.e., LINK : fatal error LNK1181: cannot open input file 'libtesseract302.lib'.
As I downloaded Tesseract OCR. In Tesseract-OCR\lib am not finding libtesseract302.dll and libtesseract302.dll files.. Am able to see only liblept168.dll, liblept168d.dll files.
I tried to searching for libtesseract302.lib & libtesseract302.dll but am not getting anything.
Am totally struck up at this point.
If anyone has used Tesseract OCR, please suggest me on this.
Thank you all..
Related
Though it perfectly compiles (CMakeFiles.txt contains proper include_directories), in editor I have "not found" for opencv2 at
#include <opencv2/opencv.hpp>
and name resolution and completion doesn't work of course, marking them "can't resolve".
What am I doing wrong?
seems include_directories absolute path doesn't work for editor at least on windows - relative path from the project folder macro made the trick...
I just downloaded Python and Visual Studio. I'm trying to test the debugging feature for a simple "Hello World" script and I'm receiving this error:
Failed to launch the Python Process, please validate the path 'python'
followed by this in the debug console:
Error: spawn python ENOENT
Could someone please help me out and tell me how to fix this?
I'm running on windows 10.
Thanks!
Do not uninstall!
1) Go to location that you installed the program.
*example: C:\Program Files (x86)\Microsoft VS Code
copy the location.
2) right click on computer> properties >Advanced System Settings> Environment variables > under user variables find "path" click> edit> under variable value: go to the end of the line add ; then paste your location>ok > then go under system variables find "path"> do the same thing.... add ; then paste your location.
FOR EXAMPLE" ;C:\Program Files (x86)\Microsoft VS Code
3) Restart your Visual Studio Code
For those who are having this error after the recent (May-June of 2017) update of Visual Studio Code.
Your old launch.json file might be causing this issue, due to the recent updates of launch.json file format and structure.
Try to delete launch.json file in the .vscode folder. The .vscode folder exists in your workspace where your source code exists, not to be confused with the one in your user home folder (C:\Users\{username}\.vscode).
This workaround worked fine for me with Windows10 + Visual Studio Code + Python extension. Just delete the existing launch.json and restart Visual Studio Code, and then start your debugging. The launch.json file might be regenerated again, but this time it should be in the correct shape.
Simply restart your VB studio code. Those show that some packages have been downloaded but not yet installed until reboot it.
Add python path by following these steps.
1. Go to uninstall a program.
2. Go to Python 3.6.1 (this is my python version). Select and click on Uninstall/change.
3.Click on Modify.
4. Click next > In advanced options > tick add Python to environment variable. Click install. Restart VS code.
This fixed it for me. The launch.json file in the .vscode folder in your working directory NOT in your program files directory needs to be opened in the Visual Studio Code editor. Here you need to find the line (for me line 13) at the top that says "pythonPath": here you type "py" and make sure to save it!! Ctrl+S. It has something to do I think with the way it looks for python spelled "python" when it needs to be spelled as "py".
Here is the link where I found the info: https://paulpccodes.blogspot.com/2017/08/fixing-failed-to-launch-python-process.html
Figured it out, if you just started python then you probably did not add python to your path.
To do so uninstall python and then reinstall it. This time click "add python to path" at the bottom of the install screen.
I have downloaded the boost library and want to include it in visual c++, but after copying in a piece of example code from the boost website, I get the error
"LNK1104 cannot open file 'libboost_regex-vc100-mt-gd-1_54'"
The file certainly exists. I'm guessing it was created when I ran the bootstrap command in the command prompt, which I followed from the guide https://www.youtube.com/watch?v=6trC5zVXzG0
The example file I use is as follows:
#include <boost/regex.hpp>
#include <iostream>
#include <string>
using namespace std;
int main()
{
string line;
boost::regex pat("^Subject: (Re: |Aw: )*(.*)");
while (cin)
{
getline(cin, line);
boost::smatch matches;
if (boost::regex_match(line, matches, pat))
cout << matches[2] << endl;
}
return 0;
}
I'm sorry but I know this kind of question has appeared several times on stack overflow, but I have tried most of the solutions I've seen and the error still exists.
Inside the solution explorer in visual c++ 2015, I write click on my proect and then click on properties, then under the VC++ directories tab, I've added the directory "C:\Program Files\Boost" into include directories, and the directory "C:\Program Files\Boost\stage\lib" into library directories. But the problem still exists. Similar questions on stack have asked to add the directory "C:\Program Files\Boost\stage\lib" to the Additional Include Directories under the general tab under the C/C++ tab, and to the Additional Include Directories under the General tab inside the Linker tab. But all these changes made no difference to the error. Another solution on stack said to add the directory "C:\Program Files\Boost\stage\lib" to the Additional dependencies under the input tab under the Linker tab, but when I did this the error changed to:
"LNK1104 cannot open file 'C:\Program Files\Boost\stage\lib.ob'"
I'm not sure if this is an improvement to the error or not
So after trying all these solutions which seemed to work for other people, I keep getting the same error. So does anyone know what could be the cause of the error.
You are getting a LNK error, which means it's likely that something is missing from your Linker properties. Make sure you've added both the boost folder and the boost\stage\lib folder to the Project Properties > configuration > Linker > "Additional Library Directories".
Also note that if you're using Visual Studio 2015, you should probably have generated the boost binaries using msvc-14.0, not msvc-10.0. Otherwise, your Platform Toolset property should be set to v100 (the default will be v140). You change this setting from Project Properties > configuration > General > "Platform Toolset", but you would need to have that version of visual studio installed.
If Aciel's answer haven't solve your problem(because I saw you haven't accept that answer yet), I believe it is because you compile your boost lib to 32-bit, and you use them in a 64-bit program.
If it's so, please try
bjam --toolset=msvc-14.0 --build-type=complete address-model=64
to rebuild your boost lib to 64-bit
I am trying to build Assimp to use in visual studio 2012.
Following the instructions on their website: http://assimp.sourceforge.net/lib_html/cmake_build.htm I have tried to build assimp, however I am stuck on the last step "Open the generated solution/project files and have fun"
This is the build folder which was created by CMake - http://puu.sh/fq8kp/cc16e985c3.png
Following the advice of another tutorial I opened this in the terminal and tried to type "make" and launch it. However there isnt a make file so this didnt work. I also typed "install" as there is an install file, however this also did not work.
The tutorial goes as follows:
Type "make" and launch it; you should see the build progressing without issues
When the build is finished, type "sudo make install"; it will ask for your password and install the library!
Any help would be much appreciated!
the 'generated solution/project' in your case (windows) would be the Assimp.sln file. You generated a visual studio solution, so you have to use Visual Studio to build the application.
According to your screenshot, the Assimp.sln file is the 9 KB sized file underneath the one with size 45,120 KB
Today is officially my first day with C++ :P
I've downloaded Visual C++ 2005 Express Edition and Microsoft Platform SDK for Windows Server 2003 SP1, because I want to get my hands on the open source Enso Project.
So, after installing scons I went to the console and tried to compile it using scons, but I got this error:
C:\oreyes\apps\enso\enso-read-only\src\platform\win32\Include\WinSdk.h(64) : fatal error C1083: Cannot open include file: 'Windows.h': No such file or directory
scons: *** [src\platform\win32\InputManager\AsyncEventProcessorRegistry.obj] Error 2
scons: building terminated because of errors.
After checking these links:
VS ans PSDK
Include tiffi.h
Wndows.h
I've managed to configure my installation like this:
And even run this script
And I managed to compile the file below in the IDE.
// Test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <Windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
But I still get that exception in the console. Does anyone have scons experience?
EDIT
Actually (and I forgot to tell you this) I started the command prompt with the link "Visual Studio 2005 Command Prompt".
I assume this will include the paths in environment variables. Well after printing them I find that it didn't:
echo %INCLUDE%
echo %LIB%
echo %PATH%
And they were not present, so I created this .bat file:
set PATH=%PATH%;"C:\Program Files\Microsoft Platform SDK\Bin"
set INCLUDE=%INCLUDE%;"C:\ Program Files\Microsoft Platform SDK\Include"
set LIB=%LIB%;"C:\ Program Files\Microsoft Platform SDK\Lib"
Still, scons seeems not to take the vars... :(
Using the above recommendations will not work with scons: scons does not import the user environment (PATH and other variables). The fundamental problem is that scons does not handle recent versions of SDKs/VS .
I am an occasional contributor to scons, and am working on this feature ATM. Hopefully, it will be included soon in scons, but the feature is much harder to implement reliably than I first expected, partly because every sdk/compiler combination is different (and sometimes even MS does not get it right, some of their .bat files are broken), so I can't give you a date. I hope it will be included in 1.2 (to be released in approximatively one month).
You need to set the include file path (and possibly other things). At the command line this is typically done using a batch file that Visual Studio installs called vsvars32.bat (or vcvars32.bat for compatibility with VC6).
I'm not familiar with scons so I don't know the best way to get these settings configured for that tool, but for standard makefiles there's usually a line in the makefile which sets a macro variable with the include directory path and that macro is used as part of a command line parameter in the command that invokes the compiler.
Another possibility might be to have the scons process invoke vsvars32.bat or run the scons script from a command line that has been configured with the batch file.
In short you need to get the things that vsvars32.bat configures into the scons configuration somehow.
There will be a batch file similar to this one (for MSVC 2005) that sets up the environment variables:
c:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat
Step 1: Find a similar file in the Express installation folders
Step 2: Create a shortcut on the desktop with these target details and a suitably modified path:
cmd.exe /K "c:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat"
Step 3: Open the DOS prompt via this shortcut
The command line build should now work from within this console window.
You show us how you configured Visual Studio for compilations within Visual Studio but you didn't show us what command line environment you tried. Sorry I haven't tried Express versions so I don't know if they create additional Start menu shortcuts like Pro and above do. If you open a suitable command prompt with its environment variables already set then you can compile on the command line. Otherwise you have to set variables yourself or execute a batch script to set them, each time you open a command prompt.
It'll be nice when scons does this automatically. For now, I use this (run from an SDK command prompt, not sure if there is a difference if run after vsvars32.bat):
import os
env = Environment(ENV={'PATH': os.environ['PATH']})
env['ENV']['TMP'] = os.environ['TMP']
env.AppendUnique(CPPPATH=os.environ['INCLUDE'].split(';'))
env.AppendUnique(LIBPATH=os.environ['LIB'].split(';'))
This works for me while compiling wxwidgets with Visual C++ 2005 Express using the command line prompt:
REM Fix Error error C1083 'windows.h'
(Use /useenv option when compiling.)
set PDSKWIN=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2
(Change to the right one.)
set INCLUDE=%PDSKWIN%\Include;%INCLUDE%
set LIB=%PDSKWIN%\Lib;%LIB%
Then I use this line when compiling. I believe just add /useenv to your lines and everything should work fine:
vcbuild /useenv /nohtmllog /nologo name.proj (or any file to compile)