[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] Copying images from a Windows DirectShow buffer into a

From: John Ryding
Subject: [libcvd-members] Copying images from a Windows DirectShow buffer into a LibCVD Image object
Date: Sun, 22 Feb 2009 23:13:50 -0500


I am currently using LibCVD for a personal project on using Windows.

The problem that I am getting is that whenever I use any of the native methods for copying an image buffer from the Windows (using DirectShow), the image is output as larger than my program's window and looks as if 2 images are placed over each other.

Playing around with my code, I come to find that this problem does not occur when I manually copy the data from my image buffer (an unsigned char*) into the objects like so:

unsigned char* pImage = m_buffer; //The image from my webcam in windows
unsigned char *rgbDest = (unsigned char *);

rgbDest += 2; //start by advancing to first Blue byte of dest
        for(int i=0; i<CAPTURE_SIZE_X*CAPTURE_SIZE_Y; ++i) {
            *rgbDest = *pImage;
            --rgbDest; // backup to Green
            *rgbDest = *pImage;
            --rgbDest; // backup to Red
            *rgbDest = *pImage;
            rgbDest += 5; // advance to Blue of next pixel

Looking at this code, it is obvious that I must first start at the Blue pixel of my image and copy the image from the buffer as if it was a BGR image. 

I am just wondering if this is a bug in the libCVD code as I am unable to use any of the libCVD copy() or fill() methods, which from looking at the documentation, use MUCH faster methods of copying the images from buffer to object.

If this is not a bug, then why must I copy the image like a BGR image?

lastly, is there any faster way to copy the image from my USB webcam's buffer into a CVD::Image object?

Thank you.

-John Ryding

reply via email to

[Prev in Thread] Current Thread [Next in Thread]