# Blepo Download

## Downloading the library

Blepo versions available for download:

- Version 0.6.4 ( 3 Sep 2008) (9 MB)

History of 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. Hopefully one day we will have an installer that will take care of these steps automatically.

1. The DLLs in the `external/bin` directory must be in your path. This can be accomplished on WindowsXP by selecting `Start Menu -> Control Panel -> System -> Advanced -> Environment Variables -> Path -> Edit`. In the edit box, append the full path to that directory, preceded by a semicolon, for example, `; c:/blepo/external/bin`. (If you already have Visual C++ running, then close and restart it in order to load the new path.)
2. 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 previous step does not solve this problem, so you have to copy the `nasm.exe` file to an existing directory on your path, such as `C:/Windows/System32`.
3. You will need 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 Visual Studio 2005/2008, follow the same step except `Tools -> Options -> Projects -> VC++ Directories`.
   After this step, any project you create should work automatically. Alternatively, you can skip this step and add the include path individually to each project you create.

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 driver. 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 VS6.0

Once you have performed these steps, you should be able to open `Demo/Demo.dsw` or `Test/Test.dsw` in Visual C++ 6.0, compile the code, and run. These two workspaces will be a good starting point for learning how to build an executable using the library.

To create a new project to use Blepo,

1. 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)
2. 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,
     1. `Project -> Insert Project into Workspace`
     2. Select `blepo/src/blepo.dsp`
     3. Set your project to the active project again (`Project -> Set Active Project`)
     4. 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).
3. 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.

Notes:

- When compiling on 64-bit Vista, some have received the error, "Performing custom build step ... nasmw.exe is not recognized as an internal or external command". This problem has also appeared on at least one Windows XP machine. No solution has been found to the problem. The workaround is to build Blepo on another machine and copy the mmx*.obj and xmm*.obj object files.

## Converting to Visual Studio 2005/2008

Once you have followed the steps in 'Setting up your system' above,

1. Download and install VS2008 SP1, if you have not already.
2. Open Demo.dsp in VS2008. It will go through a conversion and create a Demo solution. In the Solution explorer on the left you will see the Demo project as a part of 'Solution Demo'.
3. Right click Solution Demo and add Blepo.dsp to it. Once again it will convert and add it. Now right click the Demo project and set Project Dependencies-> Demo dependent on Blepo (select the check box for Blepo).
4. Remove the following:
   - Blepo->Quick->mmx_convolve_prewitt_horiz_abs.asm
   - Blepo->Quick->mmx_convolve_prewitt_vert_abs.asm
   - Blepo->Image->FileIO->jpeglib->jpegtran.c
   because these are causing some linking problems. Blepo should build/link fine without these.
5. Make sure you have the Windows SDKs installed on your system. This is supposed to be a part of VS2008, but it depends on the installation package. It would be in C:\Program Files\Microsoft SDKs\Windows\v6.1
6. Go to Tools->Options->Projects and Solution->VC++ Directories->Include files and set "C:\Program Files\Microsoft SDKs\Windows\v6.1\Include" right at the top (above the Blepo include directory).
7. Important: Right click the Blepo project in your solution explorer:
8. Select 'All Configurations' in the dropdown box at the top
9. Blepo->Properties->Configuration properties-> C++ -> General -> Additional include directories -> add `./` and nothing else...
10. In Tools --> Options --> VC++ Directories --> Include Files, please add the following paths from your corresponding blepo directory, below the Microsoft SDK library path:
    blepo\external\Microsoft\DirectX\DXSDK\Include
    blepo\external\Microsoft\DirectX\DXSDK\Common
    blepo\external\Microsoft\DirectX\DXSDK\BaseClasses
11. Right click Blepo project->Properties->Configuration Properties->C/C++-> Preprocessor->
    In preprocessor definitions, change _WIN32_WINNT=0x400 to _WIN32_WINNT=0x500
12. Go to Demo project->Properties->Configuration properties->Linker->Input->Ignore specific library -> add LIBCMT.lib (You may not need to do this, but some people have reported that it is necessary).
13. Now go to Build -> Rebuild solution
14. Ctrl+F5 to run the Demo.
15. See the instructions above under 'Getting started with VS6.0' for creating a new project. The instructions should largely translate to VS2005/2008.
    Note: When using Visual Studio 2005/2008, you will receive compilation errors related to character strings. To fix this problem, click on your project, then Properties->Configuration Properties->General->Character set(under Project Defaults), set to "Use Multibyte Character set"

Enjoy!