Develop your first TaraXL disparity App – in 5 minutes

Published on September 6, 2018

TaraXL is e-con’s new stereo camera with acceleration support for Nvidia TX2 cards. It is primarily targeted for depth applications and provides higher performance (up to 50fps). TaraXL SDK is bundled with the TaraXL development kit. The TaraXL SDK at present only supports Nividia’s TX2 chip sets. This article explains how to develop your first program to get a disparity map.

This article assumes that you have a TX2 board and have installed the TaraXL SDK.

On the TX2, you can create a new “sample.cpp” file and copy the following code into it.

#include
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>#include “TaraXL.h”
#include “TaraXLCam.h”
#include “TaraXLDepth.h”using namespace std;
using namespace cv;
using namespace TaraXLSDK;int main () {//logic :-
//enumerate devices
//connect to a device
//set the disparity mode – high frame rate(low accuracy) or low frame rate(high accuracy)
//get disparity map
//store the disparity map to a fileTaraXL taraxl;
TaraXLCam selectedCam;
TaraXLCamList taraxlCamList;
TaraXLDepth *taraxlDepth;taraxl.enumerateDevices(taraxlCamList);
selectedCam = taraxlCamList.at(0);selectedCam.connect();
taraxlDepth = new TaraXLDepth(selectedCam);
taraxlDepth->setAccuracy(HIGH);Mat left, right, grayDisp, depthMap;
taraxlDepth->getMap(left, right, grayDisp, true, depthMap, false);imwrite(“../left.jpg”, left);
imwrite(“../right.jpg”, right);
imwrite(“../grayDisp.jpg”, grayDisp);cout << “Images saved to the disk!!!!” << endl;
}

Instructions to compile:

nvidia@tegra-ubuntu:~$ g++ sample.cpp -I /usr/local/taraxl-sdk/include/ -L /usr/local/taraxl-opencv/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs -L /usr/local/taraxl-sdk/lib -lecon_taraxl

nvidia@tegra-ubuntu:~$ ./a.out
Images saved to the disk!!!!

nvidia@tegra-ubuntu:~$ ls ..
grayDisp.jpg left.jpg right.jpg

Output images are shown below (left, right, disparity):

taraxl disparity

Please write to camerasolutions@e-consystems.com for further details and to get immediate support.

Recently Published