Blepo Download
Contents:
Downloading the library --
Setting up your system --
Getting started with Visual Studio 2008/2010 --
Getting started with Visual C++ 6.0
Downloading the library
Latest Blepo version available for download:
Previous versions
Setting up your system
Once you have downloaded the code and unzipped it, you will need to do the
following to set up your system.
- The DLLs in the external/bin directory must be in your path.
- Usually, this is done (on WindowsXP
/ Windows7) by selecting
Start Menu -> Control Panel -> System -> Advanced system settings -> Environment Variables -> Path -> Edit. In the edit box, append the
full path to that directory, preceded by a semicolon with no extra spaces, for example, ";c:/blepo/external/bin" (without the quotes).
(You might have to reboot your system for this to take effect.)
- Alternatively, if you do not have the ability to change your environment
variables for some reason, then simply copy the DLLs to the same directory as
your executable.
- The NASM assembler, which is used to compile the assembly code, must be in your executable path. The name of this file is
nasm.exe and it resides in the external/bin directory. On some systems you will not need to perform any additional step, since modifying your Path environment variable enables the compiler to find it. Oftentimes, however, the compiler does not think to look in the executable path for this executable (for some inexplicable reason), in which case you will have to copy the nasm.exe file to an existing directory in your path, such as
C:/Windows/System32 (32-bit machine) and/or
C:/Windows/SysWOW64 (64-bit machine).
In addition, if you wish to capture images from a camera (e.g., USB webcam,
Data Translation DT3120, or IEEE 1394), you will need to install the appropriate driver(s).
For IEEE1394, you need to set it to use the CMU driver by following the instructions
in Capture/CaptureIEEE1394.h. If you have any trouble, see the help in
blepo/external/doc/IEEE1394. After installing the driver, you may test
your camera using Blepo code or the CMU test application in
blepo/external/bin/1394CameraDemo.exe
Getting started with Visual Studio 2008/2010
Once you have performed these steps, open demo/Demo.sln in Visual
Studio, compile the code, and run. This solution is a good starting point for learning how to build an executable
using the library.
To create a new project to use Blepo,
- Create a project with File -> New -> Project. Enter the name of the project, then
- Either Visual C++ -> Win32 Console Application (click Application settings and check MFC), or
- Visual C++ -> MFC Application (click Application Type and select Dialog based,
which is the simplest choice)
- Make the project use the Blepo library.
- In the Solution Explorer, right click on
'Solution' -> Add -> Existing project. Select blepo/src/blepo.vcproj (VS2008) or blepo/src/blepo.vcxproj (VS2010)
- Make your project dependent upon (and link with) Blepo
- VS2008: Project -> Dependencies, check the box next to Blepo
(Note: In VS2008, project dependencies affect build order and linking.)
- VS2010: Project -> Properties -> Common Properties -> Frameworks and References -> Add New Reference. Select Blepo.
(Note: In VS2010, project dependencies only affect build order. Adding a reference sets the dependency and enforces linking also.
See here.)
- Change the project properties
(Be sure that you are changing the properties of your project, not of Blepo:
look in the title bar of the Property Pages dialog)
(Also, be sure that your changes affect both Debug and Release modes: To
do this,
Configuration -> All Configurations):
- Project -> Properties -> Configuration Properties
-> General -> Character set. Set to "Use
Multi-Byte Character Set" (This will remove the compilation errors
related to character strings.)
- Project -> Properties -> Configuration
properties -> Linker -> Input -> Ignore specific library. Add LIBCMT.lib
(In VS2010, it is called Ignore specific default libraries) (While this appears not to be necessary for console-based applications, it is for MFC applications.)
- Include the Blepo header file (#include "blepo.h"). For the compiler to find this file, you will need to do
one of the following:
- Add the blepo/src path to your project include path (Project ->
Properties -> C/C++ -> General -> Additional include directories), or
- add the path to your VC++ list of include directories (Tools -> Options ->
Projects and solutions -> VC++ Directories -> Show directories for 'Include
files'), or
- put the path into the #include statement.
- Now build the project and run.
- If you're using a Win32 Console application, then add your code in the else clause of _tmain.
(Do not forget to call EventLoop(), as mentioned in the Blepo tutorial.)
- If you're using an MFC Application, then
- doubleclick Resource files -> *.rc, then doubleclick Dialog -> IDD_*_DIALOG, where * is the name of your project, to see the dialog
- Hover over the Toolbox on the right. Click Button, then click inside the dialog to place a new button in the dialog
- Click then right-click the button, Add event handler, then click 'Add and edit' and change the 'Function handler name' if you want.
- Click 'OK'. Now, in the .cpp file insert Blepo code in the function. When you run the program and click the button, this code will be called.
- Note that you will not be able to use printf,
so instead pass a string to AfxMessageBox. Use CString::Format if you need to format a string. Example:
CString str;
int x;
str.Format("variable x = %d", x);
AfxMessageBox(str);
Of course, for viewing variables the debugger is much more efficient.
Some common errors in VS2008/2010:
- Errors with project:
- 'nasmw.exe' is not recognized as an internal or external command, operable
program or batch file.
- Did you remember to copy nasmw.exe to c:/windows/system32 and/or
c:/windows/SysWOW64? Of course, it should also work if you add c:/blepo/external/bin to your path (Be sure to restart Visual Studio), but sometimes this does not work for some unknown reason.
- error LNK2005: _sprintf already defined in msvcrtd.lib(MSVCR90D.dll)
- You forgot to tell Visual Studio to ignore LIBCMT.lib
-
Blepo.lib(jpegtran.obj) : error LNK2019: unresolved external symbol _jtransform_execute_transformation referenced in function _main
Blepo.lib(jpegtran.obj) : error LNK2019: unresolved external symbol _jcopy_markers_execute referenced in function _main
Blepo.lib(jpegtran.obj) : error LNK2019: unresolved external symbol _jtransform_adjust_parameters referenced in function _main
Blepo.lib(jpegtran.obj) : error LNK2019: unresolved external symbol _jtransform_request_workspace referenced in function _main
Blepo.lib(jpegtran.obj) : error LNK2019: unresolved external symbol _jcopy_markers_setup referenced in function _main
Blepo.lib(jpegtran.obj) : error LNK2019: unresolved external symbol _write_stdout referenced in function _main
Blepo.lib(jpegtran.obj) : error LNK2019: unresolved external symbol _read_stdin referenced in function _main
Blepo.lib(jpegtran.obj) : error LNK2019: unresolved external symbol _read_scan_script referenced in function _parse_switches
Blepo.lib(jpegtran.obj) : error LNK2019: unresolved external symbol _keymatch referenced in function _parse_switches
- You forgot to tell Visual Studio to ignore LIBCMT.lib
- error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const
wchar_t *,...)'
- You forgot to set the project to "Use Multi-Byte
Character Set"
- LINK : fatal error LNK1000: Internal error during IncrBuildImage
- This also seems to be cause by forgetting to use multi-byte character set.
- mt.exe : general error c101008a: Failed to save the updated manifest to the file ".\Debug\Foo1.exe.embed.manifest". The parameter is incorrect.
- The cause of this error is unknown; try Rebuild All.
- LINK : fatal error LNK1000: Internal error during IncrBuildImage
- This is caused by a bug in the VS2008 linker. Either of these two solutions should work:
- disable incremental linking: Project -> Properties -> Configuration
properties -> Linker -> General -> Enable incremental linking -> No.
- install VS2008 Service Pack 1
- nasm: error: more than one input file specified
- Your Blepo path has a space in it (e.g., "My Documents"). This should be fixed now (as of version 0.6.8).
- afx.h(24) : fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
- Did you forget to check 'MFC' when you created your project? To fix
this, you should either
- start over (create a new project, but this time be sure to check 'MFC'),
or
- do the following:
- In Project.Properties (be sure to select All Configurations), go to
Configuration Properties.General, and change to 'Using MFC in a shared DLL'
- Copy the stdafx.h from blepo's Demo directory to your project's directory.
Your stdafx.h might look something like this: #include "targetver.h"
whereas it should look more like this: #include <afxwin.h> , among other
lines.
- IntelliSense: #error directive: Please use the /MD switch for _AFXDLL
builds (saw this on Windows 7 64-bit VS2010, but not sure what caused it)
- In Project.Properties (select Debug), go to
Configuration Properties.C/C++.Command Line, and under 'Additional options'
type "/MDd" (without the quotes). Now select Release, and under
'Additional options' type "/MD" (without the quotes). This should
fix the problem. If you look under Configuration Properties.C/C++.Code
Generation.Runtime Library, you should see 'Multi-threaded DLL (/MD)', but for
some mysterious reason this flag does not show up in the Command Line.
- c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxv_w32.h(16):
fatal error C1189: #error : WINDOWS.H already included. MFC apps must not
#include <windows.h>
- Your stdafx.h was probably created without MFC. You will need to
start over or fix your stdafx.h (see previous).
- error LNK2001: unresolved external symbol "public: virtual __thiscall blepo::Figure::~Figure(void)"
error LNK2001: unresolved external symbol "public: __thiscall blepo::Figure::Figure(char const *,int,int,bool,bool)"
fatal error LNK1120: 2 unresolved externals
- You are not linking with Blepo. Perhaps in VS2010 you made your project dependent on Blepo but forgot to add Blepo as a reference.
Another possibility is that the blepo directory that you added to your PATH
environment variable has spaces in it, but you did not enclose it in double
quotes.
- atlsd.lib(atltypes.obj) : error LNK2005: "public: __thiscall CPoint::CPoint(void)" (??0CPoint@@QAE@XZ) already defined
- This error occurs when the project contains a reference to blepo at an old location, that is, when you have moved blepo on your hard drive so
that the project can no longer find it. You should delete the obsolete reference to blepo, then add a new reference to blepo using the new
location. If this does not work, then you will need to open the project file (with extension .vcxproj) in a text editor and manually
delete the line containing the reference to the old blepo location. Then save this file, reload the project, and add the reference to
blepo at the new location in the usual manner.
- more than one input file specified
- After version 0.6.8, this problem should not occur. The Blepo.vcxproj file should have quotes around the input filename, e.g., "%(FullPath)". However, in one case, using VS2010 on Windows 7, the Blepo.vcxproj file the quotes had been removed somehow.
- When you compile your project and try to run it, you get a warning message
saying the project is out of date, do you want to rebuild. The cause of
this is that some files in your project may not exist in the file system.
With Blepo 0.6.8, for example, the file Image/Algorithms/opencv/cv.h points to a
non-existent file; and in Blepo's Demo project, the file DirectShowForDummies.h
points to a non-existent file. Of course, both of these files exist in a
different place, but if you delete these bad pointers from the corresponding
projects, the warning should go away.
- Errors with Blepo (should not occur unless you have made changes to the
Blepo project):
- "Unable to load Haar classifier cascade" from FaceDetector.cpp
- Solution: Right click Blepo, then Properties -> Configuration Properties -> C/C++-> Command Line, Add /FC.
(This causes __FILE__ to store the absolute path of the filename.)
- WINVER not defined. Defaulting to 0x0600 (Windows Vista)
- Solution: Right click Blepo, then Properties -> Configuration Properties -> C/C++->
Preprocessor ->
Preprocessor definitions. Add _WIN32_WINNT=0x500;
- warning C4996: 'fopen': This function or variable may be unsafe. Consider
using fopen_s instead.
- Solution: Right click Blepo, then Properties -> Configuration Properties -> C/C++->
Preprocessor ->
Preprocessor definitions. Add _CRT_SECURE_NO_WARNINGS
- cv.lib(cv100.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already
defined in 1394camera.lib(1394camera.dll); second definition ignored
cv.lib(cv100.dll) : warning LNK4221: no public symbols found; archive member
will be inaccessible
...
- Solution: Right click Blepo, then Properties -> Configuration Properties ->
Librarian ->
Command line -> Additional options. Add /ignore:4006,4221
- c:\program files\microsoft visual studio9.0\vc\atlmfc\include\afxv_w32.h(169) :
fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
- This error means the Windows SDK has not been installed properly. This error occurred on an
IBM Thinkpad with WinXP. The solution was to run the installer again, check/uncheck any arbitrary feature,
then click update. This forces the installer to notice that the SDK is missing and therefore install it. (Note:
The Windows SDK is in c:\program files\microsoft sdks\windows\v6.0a)
- c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(237) : error
C2146: syntax error : missing ';' before identifier 'PVOID64'
c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(237) : error
C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7819) : error
C2146: syntax error : missing ';' before identifier 'Buffer'
c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7819) : error
C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7819) : error
C4430: missing type specifier - int assumed. Note: C++ does not support default-int
- This problem occurred once on a 32-bit XP machine (same error was reported
on a 64-bit machine). The cause of the error is not known, but the
workaround was to manually insert the line
#define POINTER_64 __ptr64
in c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h just before
line 237:
typedef void * POINTER_64 PVOID64;
- This problem may no longer occur in Blepo 0.6.9 or above, since this line has now been
inserted into external\Microsoft\DirectX\DXSDK\Include\basetsd.h.
Getting started with Visual C++ 6.0
Once you have performed the steps in "Setting up your system" above, you should be able to open Demo/Demo.dsw in Visual C++ 6.0, compile the code, and run. This workspace will be a good starting point for learning how to build an executable
using the library. However, you may first have to add the gsl (GNU
scientific library) path to your include directory:
-
In Visual C++ 6.0,
Tools -> Options -> Directories -> Include files -> add blepo\external\WinGsl, where blepo is the path to your Blepo directory.
In addition,
- The NASM assembler, which is used to compile the assembly code, must be in your executable path. The name of this file is
nasm.exe and it resides in the external/bin directory. For some inexplicable reason the step
above to modify your environment path does not
solve this problem for VS6.0, so you have to copy the nasm.exe file to an existing directory on your path, such as
C:/Windows/System32.
To create a new project to use Blepo,
- Create a project with File -> New -> Project
- Either Win32 Console Application -> An application that supports MFC, or
- MFC App Wizard (Dialog based is the simplest, but the other application types should work as well)
- Make the project use the Blepo library.
- The simplest option is to add Blepo to the workspace and make the project
dependent upon Blepo. More specifically,
- Project -> Insert Project into Workspace
- Select blepo/src/blepo.dsp
- Set your project to the active project again (Project -> Set Active Project)
- Make your project dependent upon Blepo (Project -> Dependencies, check the box next to Blepo)
- Alternatively, you can compile Blepo separately and just add the .lib files to
the project (the blepo.lib file as well as all the other .lib files in the Blepo project).
- Include the Blepo header file (#include "blepo.h"). For the compiler to find this file, you will need to do
one of the following:
- Add the blepo/src path to your project include path (Project -> Settings -> C/C++ -> Additional include directories), or
- Add the path to your VC++ list of include directories (Tools -> Options -> Directories -> Include directories), or
- Put the path into the #include statement.
- Since OpenCV (as of version 2.0) is no longer compatible with VS6.0, you will have to
tell Blepo to use the old version of OpenCV. Either
- manually
uncomment the line
#define BLEPO_I_AM_USING_VISUAL_CPP_60__ in blepo.h, or
- insert the constant into the compiler directives using Project ->
Settings -> C/C++ -> Preprocessor definitions
- Now build the project and run.
- If you're using a Win32 Console application, then add your code in the else clause of _tmain.
(Do not forget to call EventLoop(), as mentioned in the Blepo tutorial.)
- If you're using an MFC Application, then
- Click the ResourceView tab. Then click '* resources', then doubleclick Dialog -> IDD_*_DIALOG, where * is the name of your project, to see the dialog
- In the toolbar, click Button, then click inside the dialog to place a new button in the dialog.
- Right-click the button, select Class Wizard. Go to 'Message Maps' tab, then click 'BN_CLICKED' message. Click 'Add function', then change the name if you want.
- Click 'OK'. Now, in the .cpp file insert Blepo code in the function. When you run the program and click the button, this code will be called.
- Note that you will not be able to use printf, so instead pass a string to AfxMessageBox. Use CString::Format if you need to format a string. Example:
CString str;
int x;
str.Format("variable x = %d", x);
AfxMessageBox(str);
Of course, for viewing variables the debugger is much more efficient.
Some common errors in VS6.0:
- Errors with project:
- 'nasmw.exe' is not recognized as an internal or external command, operable
program or batch file.
- Did you remember to copy nasmw.exe to c:/windows/system32? Of course, it should also work if you add c:/blepo/external/bin to your path (Be sure to restart Visual Studio), but sometimes this does not work for some unknown reason.
- Are you using multiple partitions? Visual Studio has been known to be unable to find nasmw even when it is in the c:/windows/system32 directory.
The cause appears to be that the project files were on a different partition from the C: drive. A workaround is to compile all the .asm files by hand, outside Visual Studio. A batch script to make this easy can be found in the Quick directory.
- c:\stb\cvs-local\research\code\vc6\alpha1\external\opencv-2\cxoperations.hpp(190) : error C2556: 'int __cdecl cv::saturate_cast(float)' : overloaded function differs only by return type from 'unsigned short __cdecl cv::saturate_cast(float)'
- This only occurs if you are using Visual C++ 6.0. The problem is that you are using OpenCV 2.1, which is incompatible with VC6.0. Solution:
- Select Project.Settings. Select your project (not Blepo), and select 'All configurations'.
- Then go to the C/C++ tab and select Preprocessor. Under Preprocessor definitions, append to the end a comma followed by BLEPO_I_AM_USING_VISUAL_CPP_60__
- fatal error C1083: Cannot open precompiled header file:
- Do Rebuild All. As long as you have stdafx.h in your program, it should compile. However, it is recommended that you turn off precompiled headers: Project.Settings.All Configurations.C/C++.Precompiled Headers.Not using precompiled headers.
- LINK : fatal error LNK1104: cannot open file
- Usually this occurs because your program is still executing, and therefore Visual Studio cannot write to the .exe file. Stop execution and try again.
- On Windows 7, this strange behavior has been observed: The new program is stored in C:\Program Files (x86)\Microsoft Visual Studio\, but the subdirectory with the project name does not exist. What VS thinks it exists is a mystery. Solution: Save your project somewhere else.
Enjoy!