Announcement

Collapse
No announcement yet.

Webcamera

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Webcamera

    There is a June 2003 post in SourceCode forum from Herman Kieskamp titled "Webcam throught video for Windows". It is his modified version of code from Robert Valois


    There is some mangled code in Sub initcapture, third line from end
    Code:
    sendmessage glwndch, %wm_cap_get_status,ðïC(capstatus), varptr(capst)
    
    ----------------------------------------^^^^--------------------------
    I replaced the mangled text with "SIZEOF" and it compiles.

    Replacing it with "LEN" also compiles

    Does anyone know which is right?


    ===


    Elias Montoya tried it in June of 2003 and said it was "beautiful" and "a work or art"

    The buttons work more or less as it seems they should, but I cannot get it to hook up to my camera. All I get is a black screen.

    Microsoft LifeCam NX-3000, works fine with included software.

    Since Elyas got it to work I assume it does, IF one knows how to find the address of their camera and where to insert it in the code.

    The camera shows up in my Explorer folder list as the "D:" drive. Replacing what appears to be the existing camera address in the program with this does not help.

    If anyone has some pointers I would appreciate hearing them.

    ===

    PBWin9, WXP, Athelon 3200+, 500MB, lots of empty drive space

  • #2
    Larry,
    the code displays OK on my computer:
    Code:
    sub initcapture
        glwndch = capcreatecapturewindow( "vfw capture window", _
                                        %ws_child or %ws_visible, _
                                        2, 2, 640, 480, hdlg, 200)
        if glwndch <> %null then
           sendmessage glwndch, %wm_cap_driver_connect, 0, 0
           sendmessage glwndch, %wm_cap_set_callback_yield,0,codeptr(vfwyieldcallback)
           sendmessage glwndch, %wm_cap_set_callback_frame,0,codeptr(vfwframecallback)
           sendmessage glwndch, %wm_cap_set_callback_videostream,0,codeptr(vfwstreamcallback)
           sendmessage glwndch, %wm_cap_set_previewrate, 60, 0
           sendmessage glwndch, %wm_cap_set_preview, %true, 0
           sendmessage glwndch, %wm_cap_get_status, len(capstatus), varptr(capst)
           halfheight = capst.uiimageheight /2
        end if
    end sub
    Looks like it's "LEN(capstatus)"

    Paul.

    Comment


    • #3
      Thanks Paul -
      since the new improved forum system was installed I have seen mangled text like this frequently. Is there something I need to install or update to fix this?

      (In fact, it is happening in this post. I did a preview and I see that the function name capcreatecapturewindow in my code snippet has been mangled. Not sure if that will flow through to the post itself, however.)

      (And of course after adding the note above and running another preview it went away. I wish they would go away like that when I'm trying to copy code into my editor. Sigh.)

      ===

      Can it be that I'm the only one with a current interest in playing with cameras?

      While I'm waiting to find out I have, of course, been continuing to dig and experiment. I have found that the program is connecting to my camera and saving a video file.

      According to MSDN the preview mode "causes frames to be transfered from the hardware to memory and then displayed in the capture window"

      Code:
      SUB initcapture
        LOCAL rtn AS LONG
        '
          glwndch = capcreatecapturewindow( "vfw capture window", _
                                          %WS_CHILD OR %WS_VISIBLE, _
                                          2, 2, 640, 480, hdlg, 200)
          IF glwndch <> %null THEN
             sendmessage glwndch, %wm_cap_driver_connect, 0, 0
             sendmessage glwndch, %wm_cap_set_callback_yield,0,CODEPTR(vfwyieldcallback)
             sendmessage glwndch, %wm_cap_set_callback_frame,0,CODEPTR(vfwframecallback)
             sendmessage glwndch, %wm_cap_set_callback_videostream,0,CODEPTR(vfwstreamcallback)
             sendmessage glwndch, %wm_cap_set_previewrate, 60, 0
             sendmessage glwndch, %wm_cap_set_preview, %true, 0
             sendmessage glwndch, %wm_cap_get_status,LEN(capstatus), VARPTR(capst)
             halfheight = capst.uiimageheight /2
          END IF
      END SUB
      I am still seeing a black screen (in the capture window).
      The preview rate is set to 60 mSec per frame and the preview flag is true. My read of the instructions is that this is sufficient to cause the camera's data stream to appear in the capture window.

      Am I misreading it?
      Last edited by Larry Burford; 3 Jun 2009, 04:15 PM. Reason: posted version has mangled/missing text

      Comment

      Working...
      X