Can I use openCV libraries with Catapult C?

448 views Asked by At

My final aim is a face/object detection and general image processing application on a Altera DE2 FPGA. I am using Catapult C to program the FPGA (so I am using C code, not Verilog or VHDL).

My question is if Catapult C supports openCV libraries, and any hints/ links on how to install the libraries so that they run within Catapult. Are there any special considerations? Searched both Google and stackoverflow, but no luck yet. Thank you.

1

There are 1 answers

4
David Pointer On BEST ANSWER

I would not even attempt to compile the OpenCV source code for an FPGA execution target. There are too many library dependencies and microprocessor architecture oriented assumptions in OpenCV (or in any large microprocessor targeted code base).

There are compile-time and run-time libraries on any system. For one example, if we look at the run-time library dependencies of the OpenCV shared library, there are many microprocessor code libraries OpenCV itself uses:

dpointer@death:~$ ldd /usr/lib/libcv.so
linux-vdso.so.1 =>  (0x00007fff1c1ff000)
libcxcore.so.4 => /usr/lib/libcxcore.so.4 (0x00007f03279f7000)
libavformat.so.52 => /usr/lib/libavformat.so.52 (0x00007f0327701000)
libavcodec.so.52 => /usr/lib/libavcodec.so.52 (0x00007f0326ca7000)
librt.so.1 => /lib/librt.so.1 (0x00007f0326a9f000)
libz.so.1 => /lib/libz.so.1 (0x00007f0326888000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f0326683000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f032636f000)
libm.so.6 => /lib/libm.so.6 (0x00007f03260ec000)
libgomp.so.1 => /usr/lib/libgomp.so.1 (0x00007f0325edd000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f0325cc0000)
libc.so.6 => /lib/libc.so.6 (0x00007f032593a000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f0325722000)
libavutil.so.49 => /usr/lib/libavutil.so.49 (0x00007f0325513000)
libbz2.so.1.0 => /lib/libbz2.so.1.0 (0x00007f0325302000)
libgsm.so.1 => /usr/lib/libgsm.so.1 (0x00007f03250f3000)
libschroedinger-1.0.so.0 => /usr/lib/libschroedinger-1.0.so.0 (0x00007f0324e74000)
libspeex.so.1 => /usr/lib/libspeex.so.1 (0x00007f0324c5a000)
libtheora.so.0 => /usr/lib/libtheora.so.0 (0x00007f0324a0b000)
libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0x00007f0324630000)
libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x00007f0324403000)
/lib64/ld-linux-x86-64.so.2 (0x00007f03282f1000)
liboil-0.3.so.0 => /usr/lib/liboil-0.3.so.0 (0x00007f0324172000)
libogg.so.0 => /usr/lib/libogg.so.0 (0x00007f0323f6b000)
dpointer@death:~$ 

If you wanted to compile and use OpenCV on an FPGA system, you'd need to compile all of this library code for the FPGA, too. And you'd need an FPGA system run-time environment that would make sure these libraries on the FPGA were available when your code was running on the FPGA system.

It's a huge task - you'd have to compile all the libraries OpenCV uses, all the libraries required by those libraries, OpenCV itself, and your top level application code. Oh, and write a run-time environment for your FPGA system. Even if you could compile all of that, it would not fit into an FPGAs resources.

On the other hand, you could write your top level C code and any required image processing C code and compile that for an FPGA system. OpenCV source code is an outstanding reference tool for how to implement various image processing algorithms for FPGA targets.