60 m_digiclopsContext = 0;
61 m_triclopsContext = 0;
79 digiclopsCreateContext(&m_digiclopsContext);
80 digiclopsInitialize(m_digiclopsContext, 0);
83 digiclopsGetTriclopsContextFromCamera(m_digiclopsContext, &m_triclopsContext);
86 digiclopsSetImageTypes(m_digiclopsContext, LEFT_IMAGE | RIGHT_IMAGE);
94 digiclopsSetImageResolution(m_digiclopsContext, DIGICLOPS_FULL);
100 digiclopsSetImageResolution(m_digiclopsContext, DIGICLOPS_HALF);
105 digiclopsSetCameraProperty(m_digiclopsContext, DIGICLOPS_WHITEBALANCE, 117, 145,
false);
106 digiclopsSetMaxFrameRate(m_digiclopsContext, DIGICLOPS_FRAMERATE_100);
109 digiclopsStart(m_digiclopsContext);
112 triclopsSetResolution(m_triclopsContext, m_nImageHeight, m_nImageWidth);
119 if (m_digiclopsContext)
121 digiclopsDestroyContext(m_digiclopsContext);
122 m_digiclopsContext = 0;
125 if (m_triclopsContext)
127 triclopsDestroyContext(m_triclopsContext);
128 m_triclopsContext = 0;
134 if (!ppImages || !ppImages[0] || !ppImages[1] ||
135 ppImages[0]->width != width || ppImages[0]->height != height ||
136 ppImages[1]->width != width || ppImages[1]->height != height ||
141 if (digiclopsGrabImage(m_digiclopsContext) != 0)
144 digiclopsExtractTriclopsInput(m_digiclopsContext, LEFT_IMAGE, &m_colorDataLeft);
145 digiclopsExtractTriclopsInput(m_digiclopsContext, RIGHT_IMAGE, &m_colorDataRight);
147 triclopsRectifyColorImage(m_triclopsContext, TriCam_LEFT, &m_colorDataLeft, &m_colorImageLeft);
148 triclopsRectifyColorImage(m_triclopsContext, TriCam_RIGHT, &m_colorDataRight, &m_colorImageRight);
150 ConvertImages(ppImages);
155 void CTriclopsCapture::ConvertImages(
CByteImage **ppImages)
157 unsigned char *pLeftData = ppImages[0]->
pixels;
158 unsigned char *pRightData = ppImages[1]->
pixels;
159 unsigned char *pLeftRed = (
unsigned char *) m_colorImageLeft.red;
160 unsigned char *pLeftGreen = (
unsigned char *) m_colorImageLeft.green;
161 unsigned char *pLeftBlue = (
unsigned char *) m_colorImageLeft.blue;
162 unsigned char *pRightRed = (
unsigned char *) m_colorImageRight.red;
163 unsigned char *pRightGreen = (
unsigned char *) m_colorImageRight.green;
164 unsigned char *pRightBlue = (
unsigned char *) m_colorImageRight.blue;
169 int offset = 3 * (m_nImageWidth * m_nImageHeight - m_nImageWidth);
172 for (
int y = 0; y < m_nImageHeight; y++)
174 for (
int x = 0; x < m_nImageWidth; x++, offset += 3)
176 pLeftData[offset] = pLeftRed[x];
177 pLeftData[offset + 1] = pLeftGreen[x];
178 pLeftData[offset + 2] = pLeftBlue[x];
179 pRightData[offset] = pRightRed[x];
180 pRightData[offset + 1] = pRightGreen[x];
181 pRightData[offset + 2] = pRightBlue[x];
184 pLeftRed += m_colorImageLeft.rowinc;
185 pLeftGreen += m_colorImageLeft.rowinc;
186 pLeftBlue += m_colorImageLeft.rowinc;
188 pRightRed += m_colorImageLeft.rowinc;
189 pRightGreen += m_colorImageLeft.rowinc;
190 pRightBlue += m_colorImageLeft.rowinc;
193 offset -= 6 * m_nImageWidth;
CTriclopsCapture(VideoMode mode)
unsigned char * pixels
The pointer to the the pixels.
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...
bool CaptureImage(CByteImage **ppImages)