Timed Camera Capture – Update


Regards the Timed Camera Capture sample I posted last month, lots of you came across a bug in my code that slipped through my rigorous testing. I did a little code tidy up before I posted the ZIP and inadvertently removed an important line from the graph setup steps. Of course I tested it thoroughly before posting but its never a good thing to test your own code!


Anyway I have updated the ZIP file and posted over the top of the old ZIP. Here is the link: http://marcusperryman.members.winisp.net/BlogStuff/TimedCamera.zip


The error was in CGraphManager::CreateCaptureGraphInternal() where the filter graph is initially built. To make sure you have the right ZIP its 46.7kb (reported by explorer download window).


We apologies for the inconvenience.


Marcus


 


Comments (10)

  1. zechs888 says:

    Actually I have a question.  How do you set the resolution of the captured image?

  2. marcpe says:

    Unfortunately you cant set the resolution directly. You can suggest the quality but its ultimately upto the capture device to decide what its going to send you.

    Marcus

  3. thodac says:

    hi, i’d like to modify cameracapture.dll to add a preview capture, do u know how can i do?

  4. marcpe says:

    That’s a little more tricky. I presume you want a ‘video’ preview – so the user can see the live feed from the camera – and then a still capture, right?

    To achieve this you need to setup a video feed and stream the data to your preview window. When your user triggers a capture you need to stop the video feed and setup a still feed, then trigger a capture.

    To setup the preview window should be a simple case of linkning the preview filter into the graph, but from my investigations it looks like there is no default preview filters installed. So you will need to create and use your own custom filter to achieve this.

    I will have a go at this and post my finding when I get some time.

    Marcus

  5. Jim P says:

    Hello Marcus

    Not a programmer, so excuse my lack of experience should the answer to my questions be an easy one. 😉

    Does your ‘code’, once compiled and ready to be installed require a certain brand/type of PPC? Or will it work on any WM5?

    Will the image size be controlled by the settings set in the device?

    Having the feed as described above (‘video’ preview) is important to me – so I can see what the camera is about capture. Was a solution found/designed?

    Do you contract out your skills?

    Thanks

    Jim

  6. Pak says:

    Thank you for article.

    I have another question about resolution. How suggest the quality?

  7. George Styles says:

    Hi,

    Many thanks for a great article.

    I have the same question – how do you suggest the quality? ive got as far as

    IAMStreamConfig *pConfig = NULL;

    CHK(m_pCaptureGraphBuilder->FindInterface(

       &PIN_CATEGORY_PREVIEW,

       &MEDIATYPE_Video,

       m_pVideoCaptureFilter,

       IID_IAMStreamConfig,

       (void**)&pConfig

    ));

    AM_MEDIA_TYPE *pType = NULL;

    pConfig->GetFormat(&pType);

    pType->

    pConfig->SetFormat(PType);

    pConfig->Release();

    but im not sure how to go about using pType to set the quality.

    thanks

    George

  8. George Styles says:

    Hi,

    Many thanks for a great article.

    I have the same question – how do you suggest the quality? ive got as far as

    IAMStreamConfig *pConfig = NULL;

    CHK(m_pCaptureGraphBuilder->FindInterface(

       &PIN_CATEGORY_PREVIEW,

       &MEDIATYPE_Video,

       m_pVideoCaptureFilter,

       IID_IAMStreamConfig,

       (void**)&pConfig

    ));

    AM_MEDIA_TYPE *pType = NULL;

    pConfig->GetFormat(&pType);

    pType->

    pConfig->SetFormat(PType);

    pConfig->Release();

    but im not sure how to go about using pType to set the quality.

    thanks

    George

  9. Ryan Galgon says:

    Any help on using IAMStreamConfig to enumerate the possible resolutions and select a higher one? I can’t seem to get any code to work properly to do that.

  10. rgalgon says:

    For everyone asking about changing the resolution look at the source code for the WiMoBot (in the WiMo Native DLL to be specific) it shows how to enumerate the resolutions and change them.

    A question though, I noticed the code for taking the picture is a reworking of the CameraCapture code, is it possible to do this with video capture as well? I have tried adding in the missing components from the SDK Cameracapture sample and importing them and calling those functions directly but cannot get it to work. Help would be greatly appreciated.