Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

How do I set the resolution for taking snaps?

Anonymous
2010-10-29
2012-10-29

  • Anonymous
    2010-10-29

    I am using the DXSnap-2008 sample project, I am trying to set the resolution
    of the cam as follows:

    const int VIDEODEVICE = 0; // zero based index of video capture device to use
                const int VIDEOWIDTH = 1280; // Depends on video device caps
                const int VIDEOHEIGHT = 720; // Depends on video device caps
                const int VIDEOBITSPERPIXEL = 24; // BitsPerPixel values determined by device
    
                cam = new Capture(VIDEODEVICE, VIDEOWIDTH, VIDEOHEIGHT, VIDEOBITSPERPIXEL, pictureBox2);
    

    But when the sample makes a call to:

    m_ip = cam.Click()
    

    ;

    The resolution is set to 640x480.
    I am using a Microsoft iLife camera which can go up to 1280x720 HD so I cant
    understand why the resolution is not being set when the object is created?

    Any help appreciated

     

  • Anonymous
    2010-10-29

    Looking through the code I now realise that the width and heigh properties are
    being set in the 'SaveSizeInfo' method.

    // Grab the size info
                VideoInfoHeader videoInfoHeader = (VideoInfoHeader) Marshal.PtrToStructure( media.formatPtr, typeof(VideoInfoHeader) );
                m_videoWidth = videoInfoHeader.BmiHeader.Width;
                m_videoHeight = videoInfoHeader.BmiHeader.Height;
                m_stride = m_videoWidth * (videoInfoHeader.BmiHeader.BitCount / 8);
    

    I am assuming that this information is read from the web cam itself? So could
    I assume that the default resolution of the camera is 640x480 and that's why
    I'm getting that size? I have searched a bit to see whether I can change the
    default resolution of the LifeCam but can't find any info.

     
  • snarfle
    snarfle
    2010-10-29

    While the camera may be able to support higher resolutions, it may use a
    colorspace other than RGB (ie YUV). In ConfigureSampleGrabber(), it is
    specifically using RGB (which makes creating the Bitmap object easier). You
    might want to dump out all the modes the camera supports using
    DumpVCap.

    It is also possible the camera only supports these higher resolutions on a
    specific pin (other than the one DxSnap is using).

     

  • Anonymous
    2010-11-01

    Thanks for the reply snarfle.
    I tried running the DumVCap exe but get an error indicating that it can't find
    MSVCR70.dll. I have tried locating this dll but have been unsuccessful so far.
    I am trying to find some documentation on this LifeCam but again, this is
    proving difficult :(.
    If anyone has the LifeCam and has information on the colorspaces and pin
    configuration this would be appreciated.

    Snarfle, looking through the DxSnap2008 sample code, it seems to look for a
    'Still' and a 'Preview' pin. Could you suggest some other pin types I could
    try look for?

    Regards

     
  • snarfle
    snarfle
    2010-11-02

    I have re-compiled it with VS2008 and updated the web site.

     
  • JonNelson
    JonNelson
    2011-04-11

    Hi,

    I've just come across the same issue with my LifeCam... stills are always
    640x480 using DXSnap...

    Did anyone get a resolution to this?

    Many thanks

    Here is the output from DumpVCap - which appears to indicate it should be
    capable of more:

    Dump Version: 1.2

    Using device: Microsoft LifeCam Cinema
    Interface: USB

    Pin Name: Capture
    Pin direction: Output
    Pin category: Capture

    IAMVideoCompression: No
    ISpecifyPropertyPages: Yes
    IMediaSeeking: Yes
    IPinConnection: No
    IPinFlowControl: No
    IAMDroppedFrames: No
    IAMVideoProcAmp: No
    IAMVideoControlCaps: 0

    Major Type Sub Type Format Type FixedSamples Temporal Compression Sample Size
    Max Input Size Min Output Size Max Output Size Min-Max FPS Video Standard
    Video RGB24 VideoInfo Fixed NotTemporal 921600 640x480 640x480 640x480
    15.00-30.00 {none}
    Video RGB24 VideoInfo2 Fixed NotTemporal 921600 640x480 640x480 640x480
    15.00-30.00 {none}
    Video RGB24 VideoInfo Fixed NotTemporal 2764800 1280x720 1280x720 1280x720
    5.00-10.00 {none}
    Video RGB24 VideoInfo2 Fixed NotTemporal 2764800 1280x720 1280x720 1280x720
    5.00-10.00 {none}
    Video RGB24 VideoInfo Fixed NotTemporal 1566720 960x544 960x544 960x544
    7.50-10.00 {none}
    Video RGB24 VideoInfo2 Fixed NotTemporal 1566720 960x544 960x544 960x544
    7.50-10.00 {none}
    Video RGB24 VideoInfo Fixed NotTemporal 1075200 800x448 800x448 800x448
    10.00-15.00 {none}
    Video RGB24 VideoInfo2 Fixed NotTemporal 1075200 800x448 800x448 800x448
    10.00-15.00 {none}
    Video RGB24 VideoInfo Fixed NotTemporal 691200 640x360 640x360 640x360
    15.00-30.00 {none}
    Video RGB24 VideoInfo2 Fixed NotTemporal 691200 640x360 640x360 640x360
    15.00-30.00 {none}
    Video RGB24 VideoInfo Fixed NotTemporal 305280 424x240 424x240 424x240
    15.00-30.00 {none}
    Video RGB24 VideoInfo2 Fixed NotTemporal 305280 424x240 424x240 424x240
    15.00-30.00 {none}
    Video RGB24 VideoInfo Fixed NotTemporal 304128 352x288 352x288 352x288
    15.00-30.00 {none}
    Video RGB24 VideoInfo2 Fixed NotTemporal 304128 352x288 352x288 352x288
    15.00-30.00 {none}
    Video RGB24 VideoInfo Fixed NotTemporal 230400 320x240 320x240 320x240
    15.00-30.00 {none}
    Video RGB24 VideoInfo2 Fixed NotTemporal 230400 320x240 320x240 320x240
    15.00-30.00 {none}
    Video RGB24 VideoInfo Fixed NotTemporal 1440000 800x600 800x600 800x600
    7.50-10.00 {none}
    Video RGB24 VideoInfo2 Fixed NotTemporal 1440000 800x600 800x600 800x600
    7.50-10.00 {none}
    Video RGB24 VideoInfo Fixed NotTemporal 76032 176x144 176x144 176x144
    15.00-30.00 {none}
    Video RGB24 VideoInfo2 Fixed NotTemporal 76032 176x144 176x144 176x144
    15.00-30.00 {none}
    Video RGB24 VideoInfo Fixed NotTemporal 57600 160x120 160x120 160x120
    15.00-30.00 {none}
    Video RGB24 VideoInfo2 Fixed NotTemporal 57600 160x120 160x120 160x120
    15.00-30.00 {none}
    Video RGB24 VideoInfo Fixed NotTemporal 3072000 1280x800 1280x800 1280x800
    5.00-10.00 {none}
    Video RGB24 VideoInfo2 Fixed NotTemporal 3072000 1280x800 1280x800 1280x800
    5.00-10.00 {none}
    Video I420 VideoInfo Fixed NotTemporal 152064 352x288 352x288 352x288
    15.00-30.00 {none}
    Video I420 VideoInfo2 Fixed NotTemporal 152064 352x288 352x288 352x288
    15.00-30.00 {none}
    Video I420 VideoInfo Fixed NotTemporal 115200 320x240 320x240 320x240
    15.00-30.00 {none}
    Video I420 VideoInfo2 Fixed NotTemporal 115200 320x240 320x240 320x240
    15.00-30.00 {none}
    Video I420 VideoInfo Fixed NotTemporal 38016 176x144 176x144 176x144
    15.00-30.00 {none}
    Video I420 VideoInfo2 Fixed NotTemporal 38016 176x144 176x144 176x144
    15.00-30.00 {none}
    Video I420 VideoInfo Fixed NotTemporal 28800 160x120 160x120 160x120
    15.00-30.00 {none}
    Video I420 VideoInfo2 Fixed NotTemporal 28800 160x120 160x120 160x120
    15.00-30.00 {none}
    Video I420 VideoInfo Fixed NotTemporal 460800 640x480 640x480 640x480
    15.00-30.00 {none}
    Video I420 VideoInfo2 Fixed NotTemporal 460800 640x480 640x480 640x480
    15.00-30.00 {none}

    Pin Name: Video Camera Terminal
    Pin direction: Input
    Pin category: {3EBC7959-3310-493B-AA81-C7E132D56F71}

    IAMVideoCompression: No
    ISpecifyPropertyPages: Yes
    IMediaSeeking: No
    IPinConnection: No
    IPinFlowControl: No
    IAMDroppedFrames: No
    IAMVideoProcAmp: No
    IAMVideoControlCaps: 0

     
  • JonNelson
    JonNelson
    2011-04-12

    Well... the solution I found for this was nothing to do with my code or
    DirectShowLib and the DXSnap sample - but the Microsoft LifeCam software that
    was installed along with the webcam driver. After removal of the Microsoft
    Lifecam software I was able to correctly specify the resolution of the still
    image capture all the way from 640x480 through to 1280x800