Building OpenCV Using Alchemy
Building OpenCV Using Alchemy
20. 21.
Browse down to the cygwin root folder and double click on Cygwin.bat cygwin will open a command line window. Cygwin root folder/home there is now a new folder that is your user name on your computer. A Bash Profile, BashRC file, and InputRC file will be available in the username folder. Close the cygwin command line window. Open and edit your .bashrc file in a text editor like Notepad or Notepad++. Right before # Shell Options, (which happens to be line 20) enter the following lines. a) export FLEX_HOME=/cygdrive/c/Program\ Files/Adobe/Flex\ Builder\ 3/sdks/3.6.0/bin b) export ALCHEMY_HOME=/cygdrive/d/Cygwin_Alchemy/alchemy-cygwinv0.5a (if the path is D:\Cygwin_Alchemy\alchemy-cygwin-v0.5a.its should be given as /cygdrive/d/Cygwin_Alchemy/alchemy-cygwin-v0.5a) Now restart cygwin by double clicking on the Cygwin.bat again. Type cd $ALCHEMY_HOME Now type ./config Youll see some text appear warning you about adl.exe not being available. Thats ok. Close your cygwin window again. Browse down to your alchemy-cygwin-v0.5a\ directory there is a file called alchemy-setup. Open that file in notepad++. Locate the line that says # export ADL=/path/to/your/adl Locate the line that says Directly underneath this line, write: export ADL=/cygdrive/c/Program\ Files/Adobe/Flex\ Builder\ 3/sdks/3.6.0/bin/adl.exe (In my case) Note: Take care about the space in the folder names like Program\ Files Close your alchemy-setup file. Open your .bashrc file again. Under the line export ALCHEMY_HOME add the following line a) source /cygdrive/d/Cygwin_Alchemy/alchemy-cygwin-v0.5a/alchemy-setup Under that line add the following lines a) PATH=$ALCHEMY_HOME/achacks:$FLEX_HOME:$PATH b) export PATH Save the .bashrc file and close it. Launch Cygwin.bat again.
Type printenv PATH and you should get a bunch of filepaths separated by colons (:). Ensure that you see the Alchemy Path with achacks and the Flex Path as well. Type cd $ALCHEMY_HOME/bin Type ln -s llvm-stub llvm-stub.exe You will get a message saying the File exists. To ensure everything is setup correctly, just type which gcc. You should get back a path pointing to alchemy-cygwin-v0.5a/achacks/gcc
Testing alchemy
First open your command line by running Cygwin.bat Type cd $ALCHEMY_HOME/samples/stringecho Now were going to compile the C Code. Type gcc stringecho.c -03 -Wall -swc -o stringecho.swc Compiles your C code into a swc. You can ensure it was created by navigating to your alchemy directory and then looking in samples/stringecho/. You should see a file called stringecho.swc.
1. 2. 3. 4. 5. 6.
4. 5.
6. 7. 8.
Downloaded bonext-flash-opencv-bdcfbdd.zip containing the selected Opencv files required for simple matric operations and some basic opencv functions. Browse down to unzipped bonext-folder/src/opencv. This folder contains 4 folders each with cpp files. Open cygwin command line interface and type this command in each folder for src in *.cpp;do g++ -I ../../../include c Wall O3 o ${PWD##*/}_$src.o $src 2> $src.log;done Wait till all the files are built Browse down to bonext-folder/src/lapack and bonext-folder/src/zlib and type for src in *.c;do gcc -I ../../include c Wall O3 o ${PWD##*/}_$src.o $src 2> $src.log;done Once all the .o files are built. Copy all the .o files from all the folder into the bonext-folder/flash folder Flash folder contains some examples like camlib.cpp & test_cv.cpp Build this examples using the command g++ -swc Wall O3 I ../include o camlib.swc *.o camlib.cpp and g++ -swc Wall O3 I ../include o test_cv.swc *.o test_cv.cpp
Include the SWC files into the flex project. Using the functions in the mxml file
import cmodule.name_of_SWCfile.ClibInit