82 cvcam_critical_section.
Lock();
84 if (pCapturedImage && (pCapturedImage->
width != pImage->
width || pCapturedImage->
height != pImage->
height || pCapturedImage->
type != pImage->
type))
93 unsigned char *input = pImage->
pixels;
94 unsigned char *output = pCapturedImage->
pixels;
99 for (
int i = 0; i < nBytes; i += 3)
101 output[i] = input[i + 2];
102 output[i + 1] = input[i + 1];
103 output[i + 2] = input[i];
108 memcpy(output, input, nBytes);
115 cvcam_critical_section.
UnLock();
158 if (cvcamGetCamerasCount() <= 0)
162 cvcamSetProperty(0, CVCAM_PROP_ENABLE, CVCAMTRUE);
163 cvcamSetProperty(0, CVCAM_PROP_RENDER, CVCAMTRUE);
165 cvcamSetProperty(0, CVCAM_PROP_CALLBACK, (
void*)
callback);
188 if (!ppImages || !ppImages[0])
193 cvcam_critical_section.
Lock();
197 cvcam_critical_section.
UnLock();
204 cvcam_critical_section.
UnLock();
210 cvcam_critical_section.
UnLock();
217 return pCapturedImage ? pCapturedImage->
width : -1;
222 return pCapturedImage ? pCapturedImage->
height : -1;
bool CopyImage(const CByteImage *pInputImage, CByteImage *pOutputImage, const MyRegion *pROI=0, bool bUseSameSize=false)
Copies one CByteImage to another.
bool CaptureImage(CByteImage **ppImages)
ImageType
Enum specifying the supported image types.
static CByteImage * pCapturedImage
Threading::EMutexStatus Lock()
bool FlipY(const CByteImage *pInputImage, CByteImage *pOutputImage)
Flips the rows in a CByteImage vertically and writes the result to a CByteImage.
IplImage * Adapt(const CByteImage *pImage, bool bAllocateMemory=false)
Converts a CByteImage to an IplImage.
static void callback(IplImage *pIplImage)
ImageType type
The type of the image.
int width
The width of the image in pixels.
int height
The height of the image in pixels.
Implementation of mutexes for synchronization.
CMutex cvcam_critical_section
unsigned char * pixels
The pointer to the the pixels.
Threading::EMutexStatus UnLock()
CByteImage::ImageType GetType()
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...
int bytesPerPixel
The number of bytes used for encoding one pixel.