Software 3

Now, we’ll build the programs I wrote that control the camera during experiments.  These use a mixture of calls to opencv and the AVT software.  All the source code for these programs is in ~bzlab/src/AVTcode.  This is where I did the development, and there are lots of files you won’t care about as I worked on different versions to get the best speed from the camera.  I’ll list the ones we care about here.  You can ignore the other ones, but I’ll leave them there since some contain ideas that I ended up not using, but that I don’t want to throw away.

Build AVTlive

AVTlive just provides a live image from the camera on the screen to aid in aiming and focusing the camera.  Since each computer controls 2 cameras, there are 2 versions of the program, one for each camera. Do this:

[rall:~/src/AVTcode/AVTlive] bzlab% cd ~/src/AVTcode/AVTlive
[rall:~/src/AVTcode/AVTlive] bzlab% make
[ 25%] Building CXX object CMakeFiles/AVTlive1.dir/AVTlive1.cpp.o
[ 50%] Linking CXX executable AVTlive1
[ 50%] Built target AVTlive1
[ 75%] Building CXX object CMakeFiles/AVTlive2.dir/AVTlive2.cpp.o
[100%] Linking CXX executable AVTlive2
[100%] Built target AVTlive2
[rall:~/src/AVTcode/AVTlive] bzlab% cp AVTlive1 AVTlive2 /usr/local/bin

Build AVT_1frame

[rall:~/src/AVTcode/AVTlive] bzlab% cd ~/src/AVTcode/AVT_1frame
[rall:~/src/AVTcode/AVT_1frame] bzlab% make
Scanning dependencies of target AVT_1frame1
[ 25%] Building CXX object CMakeFiles/AVT_1frame1.dir/AVT_1frame1.cpp.o

[ 50%] Linking CXX executable AVT_1frame1
[ 50%] Built target AVT_1frame1

Scanning dependencies of target AVT_1frame1
[ 75%] Building CXX object CMakeFiles/AVT_1frame2.dir/AVT_1frame2.cpp.o

[100%] Linking CXX executable AVT_1frame2
[100%] Built target AVT_1frame2
[rall:~/src/AVTcode/AVT_1frame] bzlab% cp AVT_1frame1 AVT_1frame2 /usr/local/bin

Build Stream2JPEG

This is a messy bit of code.  This is what does the actual collection and saving of frames, and I did a lot of fiddling to make it as fast as possible.  But, it works, and it’s fast enough.  Ignore the warnings when compiling—they’re harmless.

[rall:~/src/AVTcode/AVT_1frame] bzlab% cd ~/src/AVTcode/NewStream2JPEG
[rall:~/src/AVTcode/NewStream2JPEG] bzlab% make Stream2JPEG1
g++   -O3  -mmacosx-version-min=10.5 -I/usr/include -D_x64 -D_OSX -Wall -I/opt/local/include -I/usr/local/include -D_REENTRANT  Stream2JPEG1.cpp Jpeg.c Lock.c Thread.c -o Stream2JPEG1  -lpthread -lz -Bdynamic -lm -lc -L/usr/local/lib -L/opt/local/lib -lPvAPI -ljpeg

clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
[rall:~/src/AVTcode/NewStream2JPEG] bzlab% make Stream2JPEG2
g++   -O3  -mmacosx-version-min=10.5 -I/usr/include -D_x64 -D_OSX -Wall -I/opt/local/include -I/usr/local/include -D_REENTRANT  Stream2JPEG2.cpp Jpeg.c Lock.c Thread.c -o Stream2JPEG2  -lpthread -lz -Bdynamic -lm -lc -L/usr/local/lib -L/opt/local/lib -lPvAPI -ljpeg
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
[rall:~/src/AVTcode/NewStream2JPEG] bzlab% make install
cp -f Stream2JPEG1 Stream2JPEG1 /usr/local/bin

Finale

These programs should now be in /usr/local/bin and available to the Igor multiblink program.

Program

Function

AVTCamAttr Sets camera properties (e.g., subframe size)
AVT_1frame1&2 Takes just 1 frame and exits
AVT_findIP Get the IP address from the camera (not used; hardcoded now)
AVTlive1&2 collects/displays live video with current subframe size
Stream2JPEG1&2 collects a movie of X frames at Y fps using current subframe size
AVTreset low-level reset of camera (rarely needed)