55 #include <sys/types.h> 60 #include "rnr/rnrconfig.h" 65 #include "opencv/cv.h" 76 Camera::Camera(
const std::string &strVideoDevName,
80 m_strVideoDevName = strVideoDevName;
81 m_nVideoIndex = getVideoIndex(m_strVideoDevName);
83 m_resVideo = resVideo;
84 m_resImage = resImage;
85 m_bCameraRunning =
false;
86 m_bTakingImage =
false;
89 if( (m_resVideo.width <= 0) || (m_resVideo.height <= 0) )
94 if( (m_resImage.width <= 0) || (m_resImage.height <= 0) )
99 if( m_nVideoIndex < 0 )
111 if( isCameraRunning() )
117 int Camera::getVideoIndex(
const string &strVideoDevName)
123 if( strVideoDevName.empty() )
125 LOGERROR(
"No video device name.");
129 else if( access(strVideoDevName.c_str(), F_OK|R_OK|W_OK) != 0 )
131 LOGSYSERROR(
"%s.", strVideoDevName.c_str());
135 else if( stat(strVideoDevName.c_str(), &statVid) != 0 )
137 LOGSYSERROR(
"%s.", strVideoDevName.c_str());
141 uMajor = major(statVid.st_rdev);
142 uMinor = minor(statVid.st_rdev);
146 LOGERROR(
"%s: Not a video device",
147 "Device major number %u != expected number %d.",
const CamRes CamResUndef
Common 4:3 aspect ratio camera resolutions.
Video and still image camera base class.
const CamRes CamResQVGA
Quarter VGA 320 x 240 res.
Camera resolution structure.
const int VideoDevMajor
major device number
const CamRes CamResVGA
VGA 640 x 480 resolution.