!! HELP !! Extracting frames in a video and comparing them THANKS ALOT!

Hi,
I need help in my project here. my project mate did this in C++, which no one else in the grp knows and so i need some help if anyone knows how to convert it to VB, if possible.

The program is supposed to pick up a unattended object (like a bomb) and send an alarm (to like SMS or a PC). so it works like that. (what i understand he said, & seeing the C++ code).
  1. capture a background
  2. start capturing video
  3. average frames (eg. 10), so small movement is not picked up (think so)
  4. if pixels are the same for too long ( xx frames) - something isn't moving then send alarm
he used C++ and open CV http://www.intel.com/technology/computing/opencv/, http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/index.html
the things needed are a digital camera and a laptop(PC) for your info. if it can be reduced it will be good also, but i don't think so.if the (C++)code is needed i can post it but its very long

i found a site that is very useful - http://www.codeproject.com/useritems/ExtractVideoFrames.asp but i still am not so clear about it, i am tring that but hopefully someone here can help. also i still need to know how do i compare bitmaps (the pixels)

Any help is appreciated


Answer this question

!! HELP !! Extracting frames in a video and comparing them THANKS ALOT!

  • abowman

    IceAngel89,

    It seems that your project is rather complicated. According too your description, I guess you are not familiar with the Bitmaps and Pixels with the comparison. Am I right In your project, I think the Windows GDI needs the Device-Dependent Bitmaps, you can have a look at the following link: http://msdn2.microsoft.com/en-us/library/ms532313.aspx

    When you capture a background, there is stilll a problem related to the Pixel, which means the DPI of the screen. This link will help you to better understand this: http://msdn.microsoft.com/library/default.asp url=/workshop/author/dhtml/overview/highdpi.asp

    Finally, the Pixel Reference is necessary for your project, please view this link shows the useage of Pixel Reference:

    http://msdn.microsoft.com/library/default.asp url=/workshop/author/dhtml/overview/highdpi.asp



  • Lord Raoul

    Hi, i think i have exceeded the time for this project, so no rush to do it now, But, i also want to learn anyway. and thanks. I will try what u have said. and anyone knows if it is possible to use Microsoft class libraries like IPhotoAcquire or DirectX. was just wondering. cos i saw some articles on MSDN about them and their methods. About how is this going, i will be going with the project mate's C++ code, which i dunno if it works. Currently working on my VB and HTML projects. due in 1 to 2 weeks time.(This post is for a Creative Thinking Project.) after that i can work on some leisure projects, maybe to build up my portfolio. And THANKS!

  • Athish

    Just thought I'd mention this one: have a look at AviSynth - it's a frameserver and you can use it to serve single frames or whole movies in a mediaplayer or a directshow graph. It uses .avs scriptfiles which should be easy to write via code and also edit manually at the same time. And I'm sure it has some powerful functions for comparing frames, as that's important when doing video-encoding which is what it's mainly used for.


  • Stefan Dobrev

    Here's a very basic example of using DirectShow as a mediaplayer:

    - Add a reference to the (COM) ActiveMovie Control Type Library (or to the c:\Windows\System32\quartz.dll)
    - Now you will see the Interop.QuartzTypeLib in your Object Browser (press F2). There you'll find the objects you can use.

    The main object for handling DirectShow, is the FilGraphManager. You create that, and then point the other interfaces at it. The FilGraphManager has its own window, but you can bind it to a control on your form, and you can also link a control as a 'sink' to handle the click-events that occur on the DirectShow videowindow.

    The code below has a working example for showing a DirectShow video inside a panel on a form. The panel will be the sink for the DirectShow video, and simply switch back and forth between fullscreenmode. It's a very basic example, though.

    Note that AviSynth is a frameserver that uses .avs scriptfiles. If you tell a mediaplayer to open an .avs file, then AviSynth steps in, reads the .avs script that points to two moviefiles joined together for example, and then feeds the mediaplayer each frame in the joined moviefiles. The Mediaplayer doen't know that, and simply thinks it's showing a normal moviefile like an .avi or .mpg.

    DirectShow is a mediaplayer, but also has the stuff that AviSynth can do (like applying filters to the video), but I thought it was a bit more complicated to get DirectShow filters set up, than to simply write scripts for AviSynth, so I never looked into DirectShow filtering.

    I don't know about direct webcam-capturing, but I'm sure it'll be possible if you delve a little deeper into it than I have:
    http://msdn.microsoft.com/library/default.asp url=/library/en-us/directshow/htm/directshow.asp
    http://msdn.microsoft.com/library/default.asp url=/library/en-us/directshow/htm/filtergraphmanager.asp
    http://msdn.microsoft.com/library/default.asp url=/library/en-us/directshow/htm/controllingthefiltergraphinvisualbasic.asp

  • R.Tutus

    Maybe i need your help again, err.... i know this is difficult, but anyway, i found that
    DirectInput - can be used to get data from input devices
    http://msdn.microsoft.com/archive/default.asp frame=true
    DirectShow - can be used to stream video http://msdn.microsoft.com/archive/default.asp frame=true
    But the problem, how do i use them can they be used in VB or only C++.
    I am trying AviSynth now. anyone knows if AviSynth can access data fm Web Cams

  • Quilnux

    Hey, Bruno thanks i was starting to give up thinking no one would answer this.
    I read the articles, but that means i can't do that in VB Actually, i saw some articles about DirectX capture class dunno if its a custom class. But its like something to extract frames etc.

  • Pradeep Gupta

    IceAngel89,

    How is your problem going I hope you have solved it :-) Actually, you can try some third-party tools to help you to extract frames in a video and compare.



  • !! HELP !! Extracting frames in a video and comparing them THANKS ALOT!