Main Page
Classes
Files
File List
File Members
src
opt_nm33_uvc
init_xu_register.cpp
Go to the documentation of this file.
1
/* */
2
/* This code is based on luvcview_wr_100823 from Opt corp. */
3
/* */
4
/* 2010/09/15 k-okada@jsk.t.u-tokyo.ac.jp */
5
6
#include <unistd.h>
7
#include <sys/types.h>
8
#include <sys/stat.h>
9
#include <fcntl.h>
10
11
#include <opencv2/opencv.hpp>
12
#if ( CV_MAJOR_VERSION >= 4)
13
#include <opencv2/highgui.hpp>
14
#else
15
#include <opencv/cv.h>
16
#include <opencv/highgui.h>
17
#endif
18
19
#include "
opt_nm33_uvc.h
"
20
21
int
main
(
int
argc,
char
* argv[]) {
22
char
dev[256];
23
int
fd;
24
if
( getuid() != 0 ) {
25
fprintf(stderr,
"\033[31m### you must run this program as a root : sudo %s\033[0m\n"
, argv[0]);
26
exit(1);
27
}
28
for
(
int
i = 0; i < 16; i++ ) {
29
sprintf(dev,
"/dev/video%d"
, i);
30
if
( ( fd = open((
const
char
*)dev,O_RDWR)) > 0 ) {
31
fprintf(stderr,
";; video capabilities %s(%d)\n"
, dev, fd);
32
33
struct
v4l2_capability vd;
34
memset(&vd, 0,
sizeof
(
struct
v4l2_capability));
35
if
(ioctl(fd, VIDIOC_QUERYCAP, &vd) < 0) {
36
perror(
"ioctl(VIDIOC_QUERYCAP)"
);
37
return
false
;
38
}
39
fprintf(stderr,
";; vd.driver = %s\n"
, vd.driver);
40
fprintf(stderr,
";; vd.card = %s\n"
, vd.card);
41
fprintf(stderr,
";; vd.buf_info = %s\n"
, vd.bus_info);
42
fprintf(stderr,
";; vd.version = %d\n"
, vd.version);
43
44
if
(strcmp(
"NM30 Ultra Wideview Camera"
, (
const
char
*)vd.card) == 0 ) {
45
set_XU_control
(fd);
46
}
47
}
48
}
49
}
50
main
int main(int argc, char *argv[])
Definition:
init_xu_register.cpp:21
set_XU_control
int set_XU_control(int vd)
Definition:
opt_nm33_uvc.cpp:101
opt_nm33_uvc.h
opt_camera
Author(s): Kei Okada
autogenerated on Tue May 11 2021 02:55:43