I have code which worked on a TX1 which fails on the TX2 :
#include <opencv2/opencv.hpp>
#include <opencv2/gpu/gpu.hpp>
using namespace std;
using namespace cv;
int main(void)
{
Mat foo;
gpu::GpuMat f32Mat;
gpu::GpuMat(foo).convertTo(f32Mat, CV_32FC3);
return 0;
}
OpenCV Error: Gpu API call (invalid device function) in call, file /hdd/buildbot/slave_jetson_tx_3/35-O4T-L4T-R24/opencv/modules/gpu/include/opencv2/gpu/device/detail/transform_detail.hpp, line 361
terminate called after throwing an instance of 'cv::Exception'
what(): /hdd/buildbot/slave_jetson_tx_3/35-O4T-L4T-R24/opencv/modules/gpu/include/opencv2/gpu/device/detail/transform_detail.hpp:361: error: (-217) invalid device function in function call
Aborted (core dumped)
Just tried your code on tx1 with JepPack2.3.1.
Also meet the same error.
OpenCV Error: Gpu API call (invalid configuration argument) in call, file /hdd/buildbot/slave_jetson_tx_3/35-O4T-L4T-R24/opencv/modules/gpu/include/opencv2/gpu/device/detail/transform_detail.hpp, line 361
terminate called after throwing an instance of 'cv::Exception'
what(): /hdd/buildbot/slave_jetson_tx_3/35-O4T-L4T-R24/opencv/modules/gpu/include/opencv2/gpu/device/detail/transform_detail.hpp:361: error: (-217) invalid configuration argument in function call
Aborted
Could you help us check if this code can be successfully executed on TX1?
Had a chance to double-check this on my TX1. This seems to fail only if the Mat is empty. Looks like this is just a side effect of other problems in my code while porting to the TX2.
Sorry for the false alarm and thanks for checking into this.
I had a chance to try and debug the problem and I think there’s still a problem here. The reduced test case failed on both TX1 and TX2. Changing the foo object to a non-empty Mat makes it work on a TX1 but fail on the TX2 :
#include <opencv2/opencv.hpp>
#include <opencv2/gpu/gpu.hpp>
using namespace std;
using namespace cv;
int main(void)
{
Mat foo = Mat::eye(640,480,CV_8UC3);
gpu::GpuMat f32Mat;
gpu::GpuMat(foo).convertTo(f32Mat, CV_32FC3);
return 0;
}
OpenCV Error: Gpu API call (invalid device function) in call, file /hdd/buildbot/slave_jetson_tx_3/35-O4T-L4T-R24/opencv/modules/gpu/include/opencv2/gpu/device/detail/transform_detail.hpp, line 361
terminate called after throwing an instance of 'cv::Exception'
what(): /hdd/buildbot/slave_jetson_tx_3/35-O4T-L4T-R24/opencv/modules/gpu/include/opencv2/gpu/device/detail/transform_detail.hpp:361: error: (-217) invalid device function in function call
We found this issue recently.
Currently, libopencv_gpu.so can’t be used on TX2 since wrong compute architecture.
Please refer to topic 1000701 for more details: https://devtalk.nvidia.com/default/topic/1000701
Opencv2.4.13 or 2.4.13.2 neither of them works with 6.2 as architecture.
Tried and installed Opencv3.x, might be working but I do not want to change my source code ( it gives me lots of compilation errors unlike 2.4.13)
The point is that when I try Opencv3.x, Tegra X2’s cuda generation(one option in CCmake program) lists Pascal along with kepler and other architectures but when I compile 2.4.13.x it is not listed there so that “Auto” option does not know Pascal architecture to compile this version of Opencv properly, architecture is changed to 6.2 though.
I have Tegra X1 and the same source code works perfectly there (webcam also detected);however, I can compile the same source code on Tegra X2 (no compilation errors), but with run time error (mostly API call exceptions.
As our friends recommended above , I changed the architecture to 6.2 and compiled using the most recent Cmake version and still stuck at the same run time error after I get my code compiled.
Please give us a better solution rather than forwarding us to the links we already know.
Jetpack must be working normally and we do not have to compile opencv from scratch , it is not working though
Please give us an illustrated way of installation that you have tried on tegra X2 in such a way that opencv functions samples really work …
I think you got me wrong. Two installation methods for Opencv4tegra either from source or Jetpack(using a host PC) has no problem in my case. The real problem is when I try to test opencv with GPU once installations are over (without error). I use the following command to test a GPU accelerated OpenCV sample:
Regardless of the fact that I have tried either ways above and installation was done successfully on Tegra X2, I tried one more time as you recommended and here is the problem :
root@tegra-ubuntu:~/opencv-2.4.13/samples/gpu# ./houghlines …/cpp/logo_in_clutter.png
CPU Time : 50.5794 ms
CPU Found : 39
OpenCV Error: Gpu API call (invalid device symbol) in buildPointList_gpu, file /home/ubuntu/opencv-2.4.13/modules/gpu/src/cuda/build_point_list.cu, line 116
terminate called after throwing an instance of ‘cv::Exception’
what(): /home/ubuntu/opencv-2.4.13/modules/gpu/src/cuda/build_point_list.cu:116: error: (-217) invalid device symbol in function buildPointList_gpu
Yesterday, we also checked the GPU functionality. It works well.
Double confirm the houghlines sample, and it works correctly without error. Please check attachment.
Could you try it again?
Please also check if your opencv2.4.13 build successfully.
I did one last time and it did work. started with a clean install and flashed Tegra X2 plus Jetpack3.
Later I ran the same file you provided and it works just as I expected but there is a problem with camera now.
Camera is not detected here while on Tegra X1 it was detectable. V4l libraries are required to be built too ?
On Tegra X1 also I used to receive this message : “HIGHGUI ERROR: V4L2: Pixel format of incoming image is unsupported by openCV” but only this message was shown and camera frames was shown online. Now with Tegra X2, first of all NVCC is missing so that I used g++ instead and the same message is shown but camera is not shown after.
I suppose that we missed a library which is for camera to be built … Would you please let me know how to fix this last problem ?