Hello,
we’ve installed opencv to use it in our project, and then we have included opencv2 path
to Build → Settings → NVCC Comiler and NVCC Linker
and also to C/C++ General → Path and symbols
nevertheless we constantly get an error message: No such file or directory
sudo make -j all
[ 2%] Built target lodepng-src
[ 4%] Built target update_cuda_deps
[ 14%] Built target glfw
[ 25%] Built target dw_samples_framework
[ 27%] Built target sample_icp
[ 28%] Built target sample_radar_replay
[ 29%] Built target sample_gps_logger
[ 30%] Built target sample_imu_logger
[ 31%] Built target sample_calibration_imu
[ 32%] Built target sample_lidar_replay
[ 33%] Built target sample_egomotion
[ 34%] Building CXX object src/hello_world/CMakeFiles/sample_hello_world.dir/main.cpp.o
[ 35%] Built target sample_record
[ 36%] Built target sample_calibration_camera
[ 37%] Built target sample_camera_gmsl_raw
[ 44%] Built target sample_occupancy_grid
[ 44%] Built target sample_freespace_detection
[ 44%] Built target sample_camera_replay
[ 44%] Built target sample_camera_multiple_gmsl
[ 54%] Built target sample_canbus_interpreter
[ 54%] Built target sample_canbus_logger
[ 54%] Built target sample_lidar_accumulator
[ 52%] Built target sample_calibration_lidar
[ 54%] Built target sample_camera_usb
[ 54%] Built target dw_samples_image_common
[ 54%] Built target sample_sensors_info
[ 64%] Built target sample_lane_detection
[ 64%] Built target sample_maptracker
[ 64%] Built target sample_rig_configuration
[ 64%] Built target sample_renderer
[ 64%] Built target sample_video_rectifier
[ 65%] Built target sample_drivenetNcameras
[ 64%] Built target sample_camera_seek
[ 64%] Built target sample_camera_gmsl
[ 68%] Built target sample_render_engine
[ 71%] Built target sample_laneplanner
[ 73%] Built target sample_dataspeedBridge
[ 75%] Built target sample_camera_tracker
[ 76%] Built target sample_ipc_socketclientserver
[ 77%] Built target sample_object_detector
[ 78%] Built target sample_sfm
[ 79%] Built target sample_color_correction
[ 80%] Built target sample_vehicleio
[ 82%] Built target sample_template
[ 86%] Built target sample_mapaccess
[ 87%] Built target sample_blindness_detection
[ 88%] Built target sample_drivenet
[ 89%] Built target sample_camera_scaling_tracker
[ 91%] Built target dw_samples_stereo_common
[ 93%] Built target sample_object_tracker
[ 94%] Building CXX object src/image/image_streamer_multi/CMakeFiles/sample_image_streamer_multi.dir/main.cpp.o
[ 94%] Building CXX object src/image/image_streamer_cross_process/CMakeFiles/sample_image_streamer_cross.dir/main.cpp.o
[ 95%] Building CXX object src/image/image_streamer_simple/CMakeFiles/sample_image_streamer_simple.dir/main.cpp.o
[ 95%] Building CXX object src/image/image_capture/CMakeFiles/sample_image_capture.dir/main.cpp.o
[ 96%] Building CXX object src/stereo/stereoRectifier/CMakeFiles/sample_stereo_rectifier.dir/main.cpp.o
[ 96%] Building CXX object src/stereo/disparity/CMakeFiles/sample_stereo_disparity.dir/main.cpp.o
/usr/local/driveworks-1.2/samples-lane/src/hello_world/main.cpp:48:22: fatal error: opencv.hpp: <b>No such file or directory</b>
src/hello_world/CMakeFiles/sample_hello_world.dir/build.make:62: recipe for target 'src/hello_world/CMakeFiles/sample_hello_world.dir/main.cpp.o' failed
#include <opencv.hpp>
CMakeFiles/Makefile2:2071: recipe for target 'src/hello_world/CMakeFiles/sample_hello_world.dir/all' failed
^
compilation terminated.
make[2]: *** [src/hello_world/CMakeFiles/sample_hello_world.dir/main.cpp.o] Error 1
make[1]: *** [src/hello_world/CMakeFiles/sample_hello_world.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 97%] Linking CXX executable sample_image_streamer_cross
[ 98%] Linking CXX executable sample_image_streamer_simple
[ 99%] Linking CXX executable sample_image_capture
[ 99%] Built target sample_image_streamer_simple
[100%] Linking CXX executable sample_stereo_disparity
[100%] Built target sample_image_streamer_cross
[100%] Linking CXX executable sample_image_streamer_multi
[100%] Linking CXX executable sample_stereo_rectifier
[100%] Built target sample_image_capture
[100%] Built target sample_image_streamer_multi
[100%] Built target sample_stereo_disparity
[100%] Built target sample_stereo_rectifier
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
Our Code
/////////////////////////////////////////////////////////////////////////////////////////
// This code contains NVIDIA Confidential Information and is disclosed
// under the Mutual Non-Disclosure Agreement.
//
// Notice
// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
//
// NVIDIA Corporation assumes no responsibility for the consequences of use of such
// information or for any infringement of patents or other rights of third parties that may
// result from its use. No license is granted by implication or otherwise under any patent
// or patent rights of NVIDIA Corporation. No third party distribution is allowed unless
// expressly authorized by NVIDIA. Details are subject to change without notice.
// This code supersedes and replaces all information previously supplied.
// NVIDIA Corporation products are not authorized for use as critical
// components in life support devices or systems without express written approval of
// NVIDIA Corporation.
//
// Copyright (c) 2015-2017 NVIDIA Corporation. All rights reserved.
//
// NVIDIA Corporation and its licensors retain all intellectual property and proprietary
// rights in and to this software and related documentation and any modifications thereto.
// Any use, reproduction, disclosure or distribution of this software and related
// documentation without an express license agreement from NVIDIA Corporation is
// strictly prohibited.
//
/////////////////////////////////////////////////////////////////////////////////////////
#include <iostream>
// CORE
#include <dw/core/Context.h>
#include <dw/core/Logger.h>
#include <framework/Log.hpp>
#include <iomanip>
#include<iostream>
#include<cmath>
using namespace std;
#include <opencv.hpp>
double* polyfit(uint32_t numPoints, dwVector2f points[])
{
// N: Anzahl Punkte, n: grad
// Umwandlung
int i,j,k;
int n = 2;
double x[numPoints],y[numPoints];
for (uint32_t pointIdx = 0U; pointIdx < numPoints; ++pointIdx)
{
x[pointIdx] = (double)points[pointIdx].x;
y[pointIdx] = (double)points[pointIdx].y;
}
int N = numPoints;
// Berechnung Koeffizienten
double X[2*n+1]; //Array that will store the values of sigma(xi),sigma(xi^2),sigma(xi^3)....sigma(xi^2n)
for (i=0;i<2*n+1;i++)
{
X[i]=0;
for (j=0;j<N;j++)
X[i]=X[i]+pow(x[j],i); //consecutive positions of the array will store N,sigma(xi),sigma(xi^2),sigma(xi^3)....sigma(xi^2n)
}
double B[n+1][n+2];
static double a[3]; //B is the Normal matrix(augmented) that will store the equations, 'a' is for value of the final coefficients
for (i=0;i<=n;i++)
for (j=0;j<=n;j++)
B[i][j]=X[i+j]; //Build the Normal matrix by storing the corresponding coefficients at the right positions except the last column of the matrix
double Y[n+1]; //Array to store the values of sigma(yi),sigma(xi*yi),sigma(xi^2*yi)...sigma(xi^n*yi)
for (i=0;i<n+1;i++)
{
Y[i]=0;
for (j=0;j<N;j++)
Y[i]=Y[i]+pow(x[j],i)*y[j]; //consecutive positions will store sigma(yi),sigma(xi*yi),sigma(xi^2*yi)...sigma(xi^n*yi)
}
for (i=0;i<=n;i++)
B[i][n+1]=Y[i]; //load the values of Y as the last column of B(Normal Matrix but augmented)
n=n+1; //n is made n+1 because the Gaussian Elimination part below was for n equations, but here n is the degree of polynomial and for n degree we get n+1 equations
for (i=0;i<n;i++) //From now Gaussian Elimination starts(can be ignored) to solve the set of linear equations (Pivotisation)
for (k=i+1;k<n;k++)
if (B[i][i]<B[k][i])
for (j=0;j<=n;j++)
{
double temp=B[i][j];
B[i][j]=B[k][j];
B[k][j]=temp;
}
for (i=0;i<n-1;i++) //loop to perform the gauss elimination
for (k=i+1;k<n;k++)
{
double t=B[k][i]/B[i][i];
for (j=0;j<=n;j++)
B[k][j]=B[k][j]-t*B[i][j]; //make the elements below the pivot elements equal to zero or elimnate the variables
}
for (i=n-1;i>=0;i--) //back-substitution
{ //x is an array whose values correspond to the values of x,y,z..
a[i]=B[i][n]; //make the variable to be calculated equal to the rhs of the last equation
for (j=0;j<n;j++)
if (j!=i) //then subtract all the lhs values except the coefficient of the variable whose value is being calculated
a[i]=a[i]-B[i][j]*a[j];
a[i]=a[i]/B[i][i]; //now finally divide the rhs by the coefficient of the variable to be calculated
}
return a;
// fuer curvature abl1 : 2*a*x +b, abl2: 2*a
}
/*
double curvature(double coeff[], int x)
{
double curve = (2*coeff[0]*(doube)x)^2;
return curve
}
*/
/*
template <typename T>
std::vector<T> polyfit_boost(const std::vector<T> &xValues, const std::vector<T> &yValues, const int degree, const std::vector<T>& weights = std::vector<T>())
{
using namespace boost::numeric::ublas;
if (xValues.size() != yValues.size())
throw std::invalid_argument("X and Y vector sizes do not match");
bool useWeights = weights.size() > 0 && weights.size() == xValues.size();
// one more because of c0 coefficient
int numCoefficients = degree + 1;
size_t nCount = xValues.size();
matrix<T> X(nCount, numCoefficients);
matrix<T> Y(nCount, 1);
// fill Y matrix
for (size_t i = 0; i < nCount; i++)
{
if (useWeights)
Y(i, 0) = yValues[i] * weights[i];
else
Y(i, 0) = yValues[i];
}
// fill X matrix (Vandermonde matrix)
for (size_t nRow = 0; nRow < nCount; nRow++)
{
T nVal = 1.0f;
for (int nCol = 0; nCol < numCoefficients; nCol++)
{
if (useWeights)
X(nRow, nCol) = nVal * weights[nRow];
else
X(nRow, nCol) = nVal;
nVal *= xValues[nRow];
}
}
// transpose X matrix
matrix<T> Xt(trans(X));
// multiply transposed X matrix with X matrix
matrix<T> XtX(prec_prod(Xt, X));
// multiply transposed X matrix with Y matrix
matrix<T> XtY(prec_prod(Xt, Y));
// lu decomposition
permutation_matrix<int> pert(XtX.size1());
const std::size_t singular = lu_factorize(XtX, pert);
// must be singular
assert(singular == 0);
// backsubstitution
lu_substitute(XtX, pert, XtY);
// copy the result to coeff
return std::vector<T>(XtY.data().begin(), XtY.data().end());
}
Calculates the value of a polynomial of degree n evaluated at x. The input
argument coefficients is a vector of length n+1 whose elements are the coefficients
in incremental powers of the polynomial to be evaluated.
param:
coefficients polynomial coefficients generated by polyfit() function
xValues x axis values
return:
Fitted Y values.
*/
/*
template<typename T>
std::vector<T> polyval( const std::vector<T>& coefficients, const std::vector<T>& xValues )
{
size_t nCount = xValues.size();
size_t nDegree = coefficients.size();
std::vector<T> yValues( nCount );
for (size_t i = 0; i < nCount; i++ )
{
T yVal = 0;
T xPowered = 1;
T xVal = xValues[i];
for (size_t j = 0; j < nDegree; j++ )
{
// multiply current x by coefficient
yVal += coefficients[j] * xPowered;
// power up the X
xPowered *= xVal;
}
yValues[i] = yVal;
}
return yValues;
}
*/
//------------------------------------------------------------------------------
void printProperties(cudaDeviceProp *props)
{
const char *sComputeMode[] =
{
"Default (multiple host threads can use ::cudaSetDevice() with device simultaneously)",
"Exclusive (only one host thread in one process is able to use ::cudaSetDevice() with this device)",
"Prohibited (no host thread can use ::cudaSetDevice() with this device)",
"Exclusive Process (many threads in one process is able to use ::cudaSetDevice() with this device)",
"Unknown",
NULL
};
std::cout << "CUDA Capability Major/Minor version number: " << props->major << "." << props->minor
<< std::endl
<< "Total amount of global memory in MBytes:" << static_cast<float64_t>(props->totalGlobalMem)/1048576.0
<< std::endl
<< "Memory Clock rate Ghz: " << props->memoryClockRate
<< std::endl
<< "Memory Bus Width bits: " << props->memoryBusWidth
<< std::endl
<< "L2 Cache Size: " << props->l2CacheSize
<< std::endl
<< "Maximum 1D Texture Dimension Size (x): " << props->maxTexture1D
<< std::endl
<< "Maximum 2D Texture Dimension Size (x,y): " << props->maxTexture2D[0] << ", " <<
props->maxTexture2D[1]
<< std::endl
<< "Maximum 3D Texture Dimension Size (x,y,z): " << props->maxTexture3D[0] << ", " <<
props->maxTexture3D[1] << ", " <<
props->maxTexture3D[2]
<< std::endl
<< "Maximum Layered 1D Texture Size, (x): " << props->maxTexture1DLayered[0] << " num: " <<
props->maxTexture1DLayered[1]
<< std::endl
<< "Maximum Layered 2D Texture Size, (x,y): " << props->maxTexture2DLayered[0] << ", " <<
props->maxTexture2DLayered[0] << " num: " <<
props->maxTexture2DLayered[2]
<< std::endl
<< "Total amount of constant memory bytes: " << props->totalConstMem
<< std::endl
<< "Total amount of shared memory per block bytes: " << props->sharedMemPerBlock
<< std::endl
<< "Total number of registers available per block: " << props->regsPerBlock
<< std::endl
<< "Warp size: " << props->warpSize
<< std::endl
<< "Maximum number of threads per multiprocessor: " << props->maxThreadsPerMultiProcessor
<< std::endl
<< "Maximum number of threads per block: " << props->maxThreadsPerBlock
<< std::endl
<< "Max dimension size of a thread block (x,y,z): " << props->maxThreadsDim[0] << "," <<
props->maxThreadsDim[1] << "," <<
props->maxThreadsDim[2]
<< std::endl
<< "Max dimension size of a grid size (x,y,z): " << props->maxGridSize[0] << "," <<
props->maxGridSize[1] << "," <<
props->maxGridSize[2]
<< std::endl
<< "Maximum memory pitch bytes: " << props->memPitch
<< std::endl
<< "Texture alignment bytes: " << props->textureAlignment
<< std::endl
<< "Concurrent copy and kernel execution: " << (props->deviceOverlap ? "Yes" : "No") <<
", copy engines num: " << props->asyncEngineCount
<< std::endl
<< "Run time limit on kernels: " << (props->kernelExecTimeoutEnabled ? "Yes" : "No")
<< std::endl
<< "Integrated GPU sharing Host Memory: " << (props->integrated ? "Yes" : "No")
<< std::endl
<< "Support host page-locked memory mapping: " << (props->canMapHostMemory ? "Yes" : "No")
<< std::endl
<< "Alignment requirement for Surfaces: " << (props->surfaceAlignment ? "Yes" : "No")
<< std::endl
<< "Device has ECC support: " << (props->ECCEnabled ? "Enabled" : "Disabled")
<< std::endl
<< "Device supports Unified Addressing (UVA): " << (props->unifiedAddressing ? "Yes" : "No")
<< std::endl
<< "Device PCI Domain ID: " << props->pciDomainID << ", "
"Device PCI Bus ID: " << props->pciBusID << ", "
"Device PCI location ID: " << props->pciDeviceID
<< std::endl
<< "Compute Mode: " << sComputeMode[props->computeMode]
<< std::endl
<< "Concurrent kernels: " << props->concurrentKernels
<< std::endl
<< "Concurrent memory: " << props->concurrentManagedAccess
<< std::endl
<< std::endl;
}
//------------------------------------------------------------------------------
int main(int argc, char **argv)
{
(void)argc;
(void)argv;
std::cout << "*************************************************" << std::endl;
std::cout << "Welcome to Driveworks SDK" <<std::endl;
dwContextHandle_t sdk = DW_NULL_HANDLE;
// create a Logger to log to console
// we keep the ownership of the logger at the application level
dwLogger_initialize(getConsoleLoggerCallback(true));
dwLogger_setLogLevel(DW_LOG_VERBOSE);
// instantiate Driveworks SDK context
dwContextParameters sdkParams = {};
dwVersion sdkVersion;
dwGetVersion(&sdkVersion);
dwStatus status = dwInitialize(&sdk, sdkVersion, &sdkParams);
if (status != DW_SUCCESS) {
std::cerr << "Cannot init SDK" << std::endl;
return -1;
}
std::cout << "Context of Driveworks SDK successfully initialized." <<std::endl;
std::cout << "Version: " << sdkVersion.major << "." << sdkVersion.minor << "." << sdkVersion.patch << std::endl;
int32_t gpuCount;
status = dwContext_getGPUCount(&gpuCount, sdk);
if (status != DW_SUCCESS) {
std::cerr << "Cannot get GPU count" << std::endl;
return -1;
}
std::cout << "GPU devices detected: " << gpuCount <<std::endl;
cudaDeviceProp properties{};
for (int32_t i = 0; i < gpuCount; ++i) {
int32_t driverVersion, runtimeVersion;
status = dwContext_selectGPUDevice(i, sdk);
if (status != DW_SUCCESS) {
std::cerr << "Cannot select GPU" << std::endl;
return -1;
}
status = dwContext_getCUDAProperties(&driverVersion, &runtimeVersion, sdk);
if (status != DW_SUCCESS) {
std::cerr << "Cannot get CUDA properties" << std::endl;
return -1;
}
status = dwContext_getGPUProperties(&properties, i, sdk);
if (status != DW_SUCCESS) {
std::cerr << "Cannot get GPU properties" << std::endl;
return -1;
}
std::cout << "----------------------------------------------" << std::endl;
std::cout << "Device: " << i << ", " << properties.name << std::endl;
std::cout << "CUDA Driver Version / Runtime Version : " << driverVersion/1000 << "." <<
(driverVersion%100)/10 << " / " << runtimeVersion/1000 << "." << (runtimeVersion%100)/10
<< std::endl;
printProperties(&properties);
}
// release used objects in correct order
dwRelease(&sdk);
dwLogger_release();
std::cout << "Happy autonomous driving!" <<std::endl;
uint32_t pointAnz = 5;
dwVector2f points[pointAnz] = { 0 };
points[0].x = 0;
points[0].y = 1;
points[1].x = 1;
points[1].y = 1.8;
points[2].x = 2;
points[2].y = 1.3;
points[3].x = 3;
points[3].y = 2.5;
points[4].x = 4;
points[4].y = 6.3;
double* coeff;
coeff = polyfit(pointAnz, points);
std::cout << *coeff <<std::endl;
std::cout << *(coeff+1) <<std::endl;
std::cout << *(coeff+2) <<std::endl;
return 0;
}
Do you know what could be the problem here?
Thank you