Solved

motion detection?

Posted on 2001-09-13
11
816 Views
Last Modified: 2010-05-18
any algorithm for analysing pictures and reporting if any motion detected? any ideas where to start searching on this subject?

thanks
0
Comment
Question by:zastava101
11 Comments
 
LVL 2

Expert Comment

by:alexstewart@beta
ID: 6481318
As a start, you can subtract an image from a later one. Only moving objects and noise will appear in the difference. The edges are highlighted for the objects that move, in the direction of motion. You can use this to measure the motion.

Cross correlation will let you pick similar obejcts out between two images.

You should learn about fourier transforms to understand some of the details.

Books

Jaehne Digital image processing 1991 Springer
Pratt Digital image processing 1991 Wiley
Gonzalez, Woods Digital image processing 1992 Adison Wesley
and Lim

To experiment you could start with subrtaction, use an offset to stop numbers going negative.

One way of looking at motion is that you are looking at tited objects in the 3D space of images. (stationary objects form pillars in this space, the same in every plane)

Good motion detection is critical to Mpeg4 encoding, so it is a very current field.

as
0
 
LVL 3

Expert Comment

by:lopem
ID: 6481344
the logitech quickcam (a very inexpensive webcam) has some algorithms for motion detection.  Check www.logitech.com for more info about webcams and the SDK for quickcam programming (there is a way to link it to delphi. Search also here for webcam programming and Delphi).

Hope this help.
Manuel Lopez (lopem)
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 6481492
OpenCV from Intel is a Open Source project for image algorithms. It is in C, but accessing the DLLs from Delphi should be possible.
Search Intels website for "OpenCV". There is a mailinglist at OpenCV@yahoogroups.com.
Join by sending an empty message to OpenCV-subscribe@yahoogroups.com
0
 
LVL 12

Accepted Solution

by:
Lee_Nover earned 100 total points
ID: 6482044
hi .. I have the code made in Delphi
it uses FastLib components (free)
here it is

add fastdib, fastblend, FConvert, FastFX to uses clause


var
  oldDIB, newDIB, diffDIB: TFastDIB;
  lastBMP: TBitmap;

// I just took the code out and put it in this dummy procedure
procedure DetectMotion;
var C, w, h, x, y, t: Integer;
begin
    // load the new bitmap from anywhere
    lastBMP.LoadFromStream(FFrameStream);

     if lastBMP.Handle = 0 then exit;
     try
        oldDib.MakeCopy(newDib, true);

        // load the source .. then copy it grayscale to newDIB
        diffDIB.LoadFromHandle(lastBMP.Handle);

        FConvert.ConvertTo(diffDIB, 16);
        FastFX.Grayscale(diffDIB, newDIB);

        diffDIB.MakeCopy(oldDIB, true);
        FastFX.Grayscale(diffDIB, oldDIB);
        FConvert.ConvertTo(diffDIB, 8);

        FastBlend.DifBlend(diffDIB, oldDIB, newDIB);

        w:=diffDIB.Width-1;
        h:=diffDIB.Height-1;

        for x:=0 to w do
            for y:=0 to h do
                Inc(C, diffDIB.GetPixelB(y, x));

     finally
     end;

     if (c = 0) then
        t:=-1
     else// number of pixels * number of bits
        t:=Trunc((C * 100) / ((h+1) * (w+1) * 8));
     // we get the average lightness in t
end;

... now just check your ratio (change percent)

this works great for me :)
about 0-1% cpu usage on (pIII 550) 100 msec check intervals
0
 
LVL 1

Expert Comment

by:Dennis9
ID: 6484040
listing..
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 14

Expert Comment

by:AvonWyss
ID: 6485618
Lee_Nover, welcome to Experts Exchange.

I think it was not appropriate to make your post an answer because of the following:
* As I can see, your code does only detect whether motion was present, but not WHAT has moved. In many application it's important to detect WHAT has moved.
* Only post something as answer if you are "300% certain" that this is the one and only answer to the
question, and no other exuert has answered it already (maybe as comment).

Comments can be accepted as answer by the person which asked the initial question, so that you don't
have to be afraid of posting comments. If your comment is the one which answers the question best, you'll
get rewarded even though you did not post an answer. Comments do not lock the question for others, that's
why most experts choose to comment only so that other experts have a chance of seeing the question and post their opinions.

For more information, please read http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 6486712
well looking at the question (any algorithm for analysing pictures and reporting if any motion detected) ...

in the future i will post comments not answers

I just hope it does what zastava101 wanted
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6489572
listening
0
 
LVL 3

Expert Comment

by:gandalf_the_white
ID: 6499221
listening...
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6872423
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if still open in seven days.  Please post closing recommendations before that time.

Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.20001252.html
http://www.experts-exchange.com/questions/Q.20026086.html
http://www.experts-exchange.com/questions/Q.20066091.html
http://www.experts-exchange.com/questions/Q.20070791.html
http://www.experts-exchange.com/questions/Q.20070795.html
http://www.experts-exchange.com/questions/Q.20081086.html
http://www.experts-exchange.com/questions/Q.20081708.html
http://www.experts-exchange.com/questions/Q.20082186.html
http://www.experts-exchange.com/questions/Q.20087813.html
http://www.experts-exchange.com/questions/Q.20094507.html
http://www.experts-exchange.com/questions/Q.20103740.html
http://www.experts-exchange.com/questions/Q.20104227.html
http://www.experts-exchange.com/questions/Q.20108539.html
http://www.experts-exchange.com/questions/Q.20112131.html
http://www.experts-exchange.com/questions/Q.20118798.html
http://www.experts-exchange.com/questions/Q.20141336.html
http://www.experts-exchange.com/questions/Q.20157666.html
http://www.experts-exchange.com/questions/Q.20159442.html
http://www.experts-exchange.com/questions/Q.20177987.html
http://www.experts-exchange.com/questions/Q.20182504.html
http://www.experts-exchange.com/questions/Q.20193634.html
http://www.experts-exchange.com/questions/Q.20194167.html
http://www.experts-exchange.com/questions/Q.20090036.html
http://www.experts-exchange.com/questions/Q.20265702.html


To view your locked questions, please click the following link(s) and evaluate the proposed answer.
http://www.experts-exchange.com/questions/Q.20002824.html
http://www.experts-exchange.com/questions/Q.20179302.html
http://www.experts-exchange.com/questions/Q.20182632.html

PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.  Also, if you are interested in the cleanup effort, please click this link http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7071432
Zero response, finalized.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now