problem with TX1 usb camera
ccchen
I am a newer TX1.I am trying to use a USB camera on tx1 boardwith opencv2.4.10. Here is the c++ code.- int main() { //char* gst = "nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)320, height=(int)240, format=(string)I420, framerate=(fraction)120/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)I420 ! videoconvert ! video/x-raw, format=(string)BGR ! appsink"; // VideoCapture cap(gst); //VideoCapture cap("nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)320, height=(int)240, format=(string)I420, framerate=(fraction)120/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)I420 ! videoconvert ! video/x-raw, format=(string)BGR ! appsink"); VideoCapture cap(0); Mat frame; if(cap.isOpened()) {cout<<"1"<<endl; while(1) { namedWindow("1",1); cap>>frame; imshow("1",frame); waitKey(30); } } return 0; }
复制代码 and there is the error: (DEBUG) try_init_v4l2 VIDIOC_ENUMINPUT "/dev/video0": Inappropriate ioctl for device Unable to stop the stream.: Device or resource busy Unable to stop the stream.: Bad file descriptor 1 VIDIOC_STREAMON: Inappropriate ioctl for device I also try with gstreamer and nvgstcapture-1.0-sample,- gst-launch-1.0 nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory: NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! nvtee ! nvvidconv flip-method=2 ! 'video/x-raw(memory: NVMM), format=(string)I420' ! nvoverlaysink -e
复制代码 Also the error: Invalid FPSRange Input Setting pipeline to PAUSED ... Inside NvxLiteH264DecoderLowLatencyInitNvxLiteH264DecoderLowLatencyInit set DPB and MjstreamingInside NvxLiteH265DecoderLowLatencyInitNvxLiteH265DecoderLowLatencyInit set DPB and MjstreamingSocket read error. Camera Daemon stopped functioning..... gst_nvcamera_open() failed ret=0 ERROR: Pipeline doesn't want to pause. Setting pipeline to NULL ... Freeing pipeline ... And still cannot get the stream from camera, please help me! Thanks!
I am a newer TX1.I am trying to use a USB camera on tx1 boardwith opencv2.4.10. Here is the c++ code.
1. int main()
2. {
3.
4. //char* gst = "nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)320, height=(int)240, format=(string)I420, framerate=(fraction)120/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)I420 ! videoconvert ! video/x-raw, format=(string)BGR ! appsink";
5.
6. // VideoCapture cap(gst);
7.
8. //VideoCapture cap("nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)320, height=(int)240, format=(string)I420, framerate=(fraction)120/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)I420 ! videoconvert ! video/x-raw, format=(string)BGR ! appsink");
9. VideoCapture cap(0);
10.
11. Mat frame;
12. if(cap.isOpened())
13. {cout<<"1"<<endl;
14. while(1)
15. {
16. namedWindow("1",1);
17. cap>>frame;
18. imshow("1",frame);
19. waitKey(30);
20.
21. }
22.
23. }
24.
25. return 0;
26.
27. }
and there is the error:
(DEBUG) try_init_v4l2 VIDIOC_ENUMINPUT "/dev/video0": Inappropriate ioctl for device
Unable to stop the stream.: Device or resource busy
Unable to stop the stream.: Bad file descriptor
1
VIDIOC_STREAMON: Inappropriate ioctl for device
I also try with gstreamer and nvgstcapture-1.0-sample,
1. gst-launch-1.0 nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! nvtee ! nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! nvoverlaysink -e
Also the error:
Invalid FPSRange Input
Setting pipeline to PAUSED ...
Inside NvxLiteH264DecoderLowLatencyInitNvxLiteH264DecoderLowLatencyInit set DPB and MjstreamingInside NvxLiteH265DecoderLowLatencyInitNvxLiteH265DecoderLowLatencyInit set DPB and MjstreamingSocket read error. Camera Daemon stopped functioning.....
gst_nvcamera_open() failed ret=0
ERROR: Pipeline doesn't want to pause.
Setting pipeline to NULL ...
Freeing pipeline ...
And still cannot get the stream from camera, please help me!
Thanks!
#1
Posted 08/31/2016 01:59 PM
Hello, ccchen: Please search a tool called 'yavta', which can capture images from V4L2 device (usb camera in your case), to test your usb camera first. If yavta works well, opencv should work as well. as to GST, please use v4l2src plugin. br ChenJian
-----------------------------------------------------------------------------------------------------------------------------------
jachen
Hello, ccchen:
Please search a tool called 'yavta', which can capture images from V4L2 device (usb camera in your case), to test your usb camera first.
If yavta works well, opencv should work as well.
as to GST, please use v4l2src plugin.
br
ChenJian
#2
Posted 09/02/2016 08:18 AM
ccchen
Hi ChenJian: I don't find 'yavta',but I use 'cheese' to test my usb camera and it can work well. But my opencv can't work.I wonder if I miss something when I install opencv,cuda .Do you have the guide to install opencv2.4.10, ubuntu14.04 and cuda7.0 or newer version on my tx1 board. Thank you very much! br ccchen
Hi ChenJian:
I don't find 'yavta',but I use 'cheese' to test my usb camera and it can work well.
But my opencv can't work.I wonder if I miss something when I install opencv,cuda .Do you have the guide to install opencv2.4.10, ubuntu14.04 and cuda7.0 or newer version on my tx1 board.
Thank you very much!
br
ccchen
#3
Posted 09/03/2016 02:36 AM
Hello, ccchen: For opencv4tegra, You can check docs/packages @ https://developer.nvidia.com/embedded/downloads#?search=opencv USB camera should work in opencv. You can build the source code can track down why it reports error. (For the error log you pasted,- (DEBUG) try_init_v4l2 VIDIOC_ENUMINPUT "/dev/video0": Inappropriate ioctl for device
复制代码 it should have nothing to do with CUDA. You build openCV from source by yourself? if so, that looks more like the openCV is not configured correctly.) br ChenJian
jachen
Hello, ccchen:
For opencv4tegra, You can check docs/packages @ https://developer.nvidia.com/embedded/downloads#?search=opencv
USB camera should work in opencv. You can build the source code can track down why it reports error.
(For the error log you pasted,
1. (DEBUG) try_init_v4l2 VIDIOC_ENUMINPUT "/dev/video0": Inappropriate ioctl for device
it should have nothing to do with CUDA. You build openCV from source by yourself? if so, that looks more like the openCV is not configured correctly.)
br
ChenJian
#4
Posted 09/05/2016 02:44 AM
Hi,jachen: Thank you for your advice. I try to flash the os with Jetpack2.2.1 and install opencv2.4.13 .It really works and I can grab the frame from usb camera,but I want to change the resolution from 640*480 to 1920*1080 by set- cap.set(CV_CAP_PROP_FRAME_WIDTH,1920); cap.set(CV_CAP_PROP_FRAME_HEIGHT,1080);
复制代码 and it doesn't have any change. how can I solve this problem? ccchen
ccchen
Hi,jachen:
Thank you for your advice.
I try to flash the os with Jetpack2.2.1 and install opencv2.4.13 .It really works and I can grab the frame from usb camera,but I want to change the resolution from 640*480 to 1920*1080 by set
1. cap.set(CV_CAP_PROP_FRAME_WIDTH,1920);
2. cap.set(CV_CAP_PROP_FRAME_HEIGHT,1080);
and it doesn't have any change.
how can I solve this problem?
ccchen
#5
Posted 09/28/2016 12:59 PM
Hi ccchen, V4L2 camera support level depends on kernel driver mostly. We do not exclude OpenCV issue for the particular case, but most probably, some IOCTLs are not implemented for particular camera and that's why you cannot change camera resolution. As possible solution, please, try to set resolution before or after cv::VideoCapture:pen call. Thanks
kayccc
Hi ccchen,
V4L2 camera support level depends on kernel driver mostly. We do not exclude OpenCV issue for the particular case, but most probably, some IOCTLs are not implemented for particular camera and that's why you cannot change camera resolution.
As possible solution, please, try to set resolution before or after cv::VideoCapture:pen call.
Thanks
#6
Posted 09/30/2016 02:00 AM
[quote="kayccc"]Hi ccchen, V4L2 camera support level depends on kernel driver mostly. We do not exclude OpenCV issue for the particular case, but most probably, some IOCTLs are not implemented for particular camera and that's why you cannot change camera resolution. As possible solution, please, try to set resolution before or after cv::VideoCapture:pen call. Thanks[/quote] Hi kayccc, Thank you for your advice.I have tried to set resolution from 640*480 to 1920*1080 by set- VideoCapture cap(0); Mat frame; if(cap.isOpened()) { cout<<"1"<<endl; cap.set(CV_CAP_PROP_FRAME_WIDTH,1920); cap.set(CV_CAP_PROP_FRAME_HEIGHT,1080);
复制代码 after cv::VideoCapture:pen call,but I cannot make any change.Can you give some advice about how to set resolution before open call? Also,I tried to change resolution of a video ,- VideoCapture cap("video0.avi"); Mat frame; if(cap.isOpened()) { cout<<"1"<<endl; cap.set(CV_CAP_PROP_FRAME_WIDTH,1920); cap.set(CV_CAP_PROP_FRAME_HEIGHT,1080);
复制代码 but it did't have any change. Thanks
ccchen
kayccc said:Hi ccchen,
V4L2 camera support level depends on kernel driver mostly. We do not exclude OpenCV issue for the particular case, but most probably, some IOCTLs are not implemented for particular camera and that's why you cannot change camera resolution.
As possible solution, please, try to set resolution before or after cv::VideoCapture:pen call.
Thanks
Hi kayccc,
Thank you for your advice.I have tried to set resolution from 640*480 to 1920*1080 by set
1. VideoCapture cap(0);
2.
3. Mat frame;
4. if(cap.isOpened())
5. {
6. cout<<"1"<<endl;
7.
8. cap.set(CV_CAP_PROP_FRAME_WIDTH,1920);
9. cap.set(CV_CAP_PROP_FRAME_HEIGHT,1080);
after cv::VideoCapture:pen call,but I cannot make any change.Can you give some advice about how to set resolution before open call?
Also,I tried to change resolution of a video ,
1. VideoCapture cap("video0.avi");
2.
3. Mat frame;
4. if(cap.isOpened())
5. {
6. cout<<"1"<<endl;
7.
8. cap.set(CV_CAP_PROP_FRAME_WIDTH,1920);
9. cap.set(CV_CAP_PROP_FRAME_HEIGHT,1080);
but it did't have any change.
Thanks
#7
Posted 10/07/2016 02:16 AM
Hello, ccchen: For USB camera support, it's provided by openCV. You can track down the related code to dig why resolution-changing does not work. Per my point, such functions are device-related. USB camera has capabilities for its own. Some support low-resolution with raw format like RGB, and high-resolution with compressed format like JPG. I think you can find the answer by tracking down openCV core. br Chenjian
jachen
Hello, ccchen:
For USB camera support, it's provided by openCV. You can track down the related code to dig why resolution-changing does not work.
Per my point, such functions are device-related. USB camera has capabilities for its own. Some support low-resolution with raw format like RGB, and high-resolution with compressed format like JPG.
I think you can find the answer by tracking down openCV core.
br
Chenjian
#8
Posted 10/14/2016 02:31 AM
Hi jachen: When I run my code, it got the error: highgui error :v4l/v4l2:vidioc_s_crop and how can I fix it ? Thanks. br ccchen
ccchen
Hi jachen:
When I run my code ,it got the error:
highgui error :v4l/v4l2:vidioc_s_crop
and how can I fix it ?
Thanks.
br
ccchen
#9
Posted 10/17/2016 03:32 AM
Hello, ccchen: That part of code is open-source. You can compile openCV package and track down the code. br Chenjian
jachen
Hello, ccchen:
That part of code is open-source. You can compile openCV package and track down the code.
br
Chenjian
#10
Posted 10/17/2016 06:35 AM
I just tried openCV 3.1.0 for usb camera resolution change. It works well. First please confirm that usb camera can support frame size like 1920x1080. (v4l2-ctl --list-formats-ext -d /dev/video1) Compile the openCV 3.1.0. Compile the test program and link against openCV 3.1.0, the following code clip can change the resolution:- int width = 1280; int height = 720; printf("Set width to %d\n", width); cap.set(CV_CAP_PROP_FRAME_WIDTH, width); printf("Set height to %d\n", height); cap.set(CV_CAP_PROP_FRAME_HEIGHT, height);
复制代码 br Chenjian
jachen
Answer Accepted by Forum Admin
I just tried openCV 3.1.0 for usb camera resolution change. It works well.
First please confirm that usb camera can support frame size like 1920x1080. (v4l2-ctl --list-formats-ext -d /dev/video1)
Compile the openCV 3.1.0.
Compile the test program and link against openCV 3.1.0, the following code clip can change the resolution:
1. int width = 1280;
2. int height = 720;
3. printf("Set width to %d\n", width);
4. cap.set(CV_CAP_PROP_FRAME_WIDTH, width);
5. printf("Set height to %d\n", height);
6. cap.set(CV_CAP_PROP_FRAME_HEIGHT, height);
br
Chenjian
#11
Posted 10/19/2016 07:12 AM
Thank you for your advice. I will try openCV 3.1.0,but when I compile the openCV 3.1.0, there are some errors listed:- ../../lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `png_init_filter_functions_neon' collect2: error: ld returned 1 exit status apps/annotation/CMakeFiles/opencv_annotation.dir/build.make:100: recipe for target 'bin/opencv_annotation' failed make[2]: *** [bin/opencv_annotation] Error 1 CMakeFiles/Makefile2:6170: recipe for target 'apps/annotation/CMakeFiles/opencv_annotation.dir/all' failed make[1]: *** [apps/annotation/CMakeFiles/opencv_annotation.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....
复制代码 Do you know some ways to solve it? br ccchen
ccchen
Thank you for your advice.
I will try openCV 3.1.0,but when I compile the openCV 3.1.0,
there are some errors listed:
1. ../../lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `png_init_filter_functions_neon'
2. collect2: error: ld returned 1 exit status
3. apps/annotation/CMakeFiles/opencv_annotation.dir/build.make:100: recipe for target 'bin/opencv_annotation' failed
4. make[2]: *** [bin/opencv_annotation] Error 1
5. CMakeFiles/Makefile2:6170: recipe for target 'apps/annotation/CMakeFiles/opencv_annotation.dir/all' failed
6. make[1]: *** [apps/annotation/CMakeFiles/opencv_annotation.dir/all] Error 2
7. make[1]: *** Waiting for unfinished jobs....
Do you know some ways to solve it?
br
ccchen
#12
Posted 10/21/2016 07:44 AM
it looks like libpng is missed. please install some dependencies for openCV br Chenjian
jachen
it looks like libpng is missed. please install some dependencies for openCV
|