Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Getting Frames from Webcam

Getting Frames from Webcam

Scheduled Pinned Locked Moved C / C++ / MFC
c++graphicstutorialquestionannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Don Guy
    wrote on last edited by
    #1

    Hey there, I want to make a MFC app that will capture 6 frames per second from the webcam connected to the PC. And i want to get the frames as imageData, i.e., as bitmap or PNG. The idea is to get these frames/images and then update them live on a web browser, so that it gives a "look and feel" of live video streaming. I did a sample MFC app that shows webcam stream and then use the capGrabFrame & capFileSaveDIB to save the bmp to disk. This all works fine. But now rather than saving into disk, i need to get the Image Data, so that i could make changes and update in a browser window. Also, not sure whether it's possible to get 6 frames per second from the webcam. Is this possible? Please guide me with some code. Thanks in advance.

    S 1 Reply Last reply
    0
    • D Don Guy

      Hey there, I want to make a MFC app that will capture 6 frames per second from the webcam connected to the PC. And i want to get the frames as imageData, i.e., as bitmap or PNG. The idea is to get these frames/images and then update them live on a web browser, so that it gives a "look and feel" of live video streaming. I did a sample MFC app that shows webcam stream and then use the capGrabFrame & capFileSaveDIB to save the bmp to disk. This all works fine. But now rather than saving into disk, i need to get the Image Data, so that i could make changes and update in a browser window. Also, not sure whether it's possible to get 6 frames per second from the webcam. Is this possible? Please guide me with some code. Thanks in advance.

      S Offline
      S Offline
      SoMad
      wrote on last edited by
      #2

      It looks like you have gone down the Video For Windows route. You might want to consider stepping up to DirectShow instead. They are both old technologies, but VFW is just too old and annoying to deal with (we were using it on Windows 98). Whether you will be able to achieve 6 FPS really depends on several factors, primarily if your camera supports that frame rate at your desired resolution. You should be able to acquire the images as JPEGs or another bitmap format (RGB or YUV), but which formats are available depends completely on your camera. Take a look at this totally awesome CP article: Realtime Webcam Sudoku Solver[^] As I recall, it uses Video For Windows, so it should be easy for you to jump into the code and see how to access the image data. For a DirectShow sample, check out this CP article: Video Preview and Frames Capture to Memory with SampleGrabber in Buffered Mode.[^] And also browse through his other articles[^], it will not be a waste of your time. Here are a couple more DirectShow related CP articles: Simultaneous Previewing & Video Capture using DirectShow[^] DirectX Video Stream and frame capture[^] Soren Madsen

      "When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups