Running Opencv Sample on Target

I want to write a sample opencv program using the libopencvtegra that came with the jetson toolkit. How do I write the program on my ubuntu host and run it on the jetson target. What steps should I follow?

That’s a pretty big and wide-open question. The first suggestion is to at least start with a native compile on the Jetson itself, which is unusually capable compared to other embedded systems. Cross-compile isn’t usually needed.

Second, you’ll need a cross-compile tool chain (listed in other instructions). If your host is Ubuntu, those tool chains are directly available. If not ubuntu, you might need to pick up something like the Linaro tool chain. You’re looking for the ARMv7 “hard float” calling convention, typically abbreviated “eabihf”.

Test the tool chain by trying to compile just a kernel first, which is already designed to be aware of cross-compile and is the easiest of all cross compiles. Then try setting it up to work with a simple “hello world” C app. You’ll discover fairly quickly how complicated it gets, but if you can compile “hello world” apps, there won’t be a huge difference to OpenCV. The “pain” of such compiles typically involves linker paths wanting to throw your x86 host into the path when it should not, or else missing out some of the linkages at low levels. If you can’t solve those it becomes easier to ask a specific question.

FYI, there are setups that let you code in your native editor and the editor does what it needs to load the edit onto the Jetson and let Jetson compile it, although the interface is on your host editor. If you can set this up, it usually beats cross compile.