hi all , i search for motion detector documents and code source with systemC programming language, any help pls

Recommended Answers

All 40 Replies

Can you be a little more specific?

This is a well worn research area. I'll share a cheap motion detection system we used in a low budget system. NO SOURCE CODE EVER. Do not ask.

The basic method is to take a frame or bitmap and put it through a Sobel filter (what this is and code is on the web.)
Now since we had only a pitiful 16MHz CPU our image only had a few zones so in simple words we had a count of the edges in each zone and if the count changed by more than some percent or number we called that movement.

i want to deveelopp a motion detector that composed of two program,
when i activate VBA code, it command the webcam (manycam) to get video and it takes photo with defined frequencyand store them on a folder or queue ato be processed in visual studio solution(systemc) to compare each two successive frame , if there is no difference systemC (visual studio) store the process time in text file , if there is differnce systemc (Vs) make alarm and store store time process of execution system C code in text file, thank you for help me really i dont have enough time for posting my master thesis and i dont accomplish my application yet

ff.png

This post has no text-based content.

ddf.png

This post has no text-based content.

thank you dr Jim and doctor reprofitt, i you hellp me i will grateful

Sounds like you have a plan. Now go write some code to do it step by step. Many blow up on launch. That is, webcam capture to the bitmap we need to run through a Sobel filter. Have you got step 1 (image capture) done yet?

Remember that this is your app to write. I don't mind chatting how we did it on a very very small system.

Why do you insist on writing this in VBA? Why not vb.net which has more capabilities and less overhead?

dr reprofitt not yet, i start reading to understand how motion detector system function, also time is running fast and i had to prepare application and report max on june.
dr Jim as you know im obliged to deal with integrated VBA, the time before i start to try example of simple adder to try VBA and Vs automation, now i had to developp the real system

@yosri_1 I guess as a challenge you could try this in VBA. To me that's a non-starter in so many ways.

Good luck on your apps and reports.

                good evening , hi all members, i have this code and i want to modify it wshing that when debug it my webcam directy capture  images at defined frequence and store this image in folder any help plz 
 Imports AForge
    Imports AForge.Video

Imports AForge.Video.DirectShow
Imports System.IO

  Public Class Form1
 Dim CAMERA As VideoCaptureDevice
 Dim bmp As Bitmap
 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
               Dim cameras As VideoCaptureDeviceForm = New VideoCaptureDeviceForm
If cameras.ShowDialog = System.Windows.Forms.DialogResult.OK Then
    CAMERA = cameras.VideoDevice
    AddHandler CAMERA.NewFrame, New NewFrameEventHandler(AddressOf Captured)
    CAMERA.Start()
End If
 End Sub
  Private Sub Captured(Sender As Object, EventArgs As NewFrameEventArgs)
   bmp = DirectCast(EventArgs.Frame.Clone(), Bitmap)
PictureBox1.Image = DirectCast(EventArgs.Frame.Clone(), Bitmap)
 End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
PictureBox2.Image = PictureBox1.Image
 End Sub

' Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
'f SaveFileDialog1.ShowDialog = System.Windows.Forms.DialogResult.OK Then

'End If
' End Sub
End Class
Sans_titre.png

   i need help on VB.NET i want modify this function to start autmatically without button click 
   Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
           Dim cameras As VideoCaptureDeviceForm = New VideoCaptureDeviceForm
   If cameras.ShowDialog = System.Windows.Forms.DialogResult.OK Then
   CAMERA = cameras.VideoDevice
   AddHandler CAMERA.NewFrame, New NewFrameEventHandler(AddressOf Captured)
   CAMERA.Start()
   End If
   End Sub

Here's a basic item you learn as you write more VB code. If you want code that runs when the app or form loads, use form.load()'s handler.

thank you dr reprofitt :) it still the problem saving image at defined frequency pls

I don't see enough code so this is at a high level. Now that you know to put the code you want to run in form.load, put a timer on the form and in form.load, set the timer duration and enable it. Now when the timer fires, you have code to do what you want at that frequency.

        thank you deeply dr, this is my attempt dr can you help me more :  iwant when lunch the app it start the webcam and at each 2 seconds it captures a photo and save it 

       Imports AForge
       Imports AForge.Video
      Imports AForge.Video.DirectShow
     Imports System.IO

     Public Class Form1
Dim CAMERA As VideoCaptureDevice
Dim bmp As Bitmap
Dim yosri1 As Boolean = True
Private Counter As Integer = 0

Private Sub Captured(sender As Object, eventArgs As NewFrameEventArgs)
    bmp = DirectCast(eventArgs.Frame.Clone(), Bitmap)
    PictureBox1.Image = DirectCast(eventArgs.Frame.Clone(), Bitmap)
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button2.Click
    SaveFileDialog1.DefaultExt = ".jpg"
    If SaveFileDialog1.ShowDialog = System.Windows.Forms.DialogResult.OK Then
        PictureBox2.Image.Save(SaveFileDialog1.FileName, Imaging.ImageFormat.Jpeg)
    End If
End Sub

Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
    CAMERA.Stop()
End Sub

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
    Captured()
    PictureBox2.Image = PictureBox1.Image

End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Dim cameras As VideoCaptureDeviceForm = New VideoCaptureDeviceForm
    If cameras.ShowDialog = System.Windows.Forms.DialogResult.OK Then
        CAMERA = cameras.VideoDevice
        AddHandler CAMERA.NewFrame, New NewFrameEventHandler(AddressOf Captured)
        CAMERA.Start()
    End If
    ' Label1.Text = Counter.ToString
    Me.Timer1.Interval = TimeSpan.FromSeconds(10).TotalMilliseconds
    Me.Timer1.Start()
     End Sub
   End Class

You tell me what you want, I tell you to place the code to run in the form's load event handler and there's no handler in your code dump.

I think you need to find and do more tutorials on the language you are using.

you are right dr im not familiar with VB.NET this is the first time i used it i dont have enough time to learn new programming language i have a lot of thing that i should accomplish in my project beacause my thesis is on july, but im trying,
Sans_titre.png 12.png
dr i think that i should call captured function in timer_click in order to take photo every 2 sec, but i dont know how to call method with arguments can you help pls

Remember this is your thesis. You'll have to detail how it works so that means you would have to learn what tools you are using.

Big hint? Learn about the form.load handler. Google that!

i know dr but i ask for help after googling those new funtions, my problem is how can i call captunring and saving capture and save method from Timer_click method to be executed. as you show i dont have problem with Form_load
dfg.png
i open the webcam as well as enabling the timer, but when i call captured function within Timer_click method
12.png
Sans_titre.png
i dont no how to manipulating arguments, if you can help me and sorry for the disturbance.

Why call them at all?

Put the code you want to run in the timer handler.

As to calling, there are tutorials on the web today so I don't duplicate that here.

before calling captured , i tried to put the code of this finction in timer's handler but it the error is more complicated problem of event i thought ,

ghvj.png
thats why i think to call the function

Back to Aforge to check doucuments on how to call DirectCast. You didn't define EventArgs so just incomplete code at this point.

eventargs derives from class.system.
i replaced Directcast by CType it displays that frame is not member for eventargs

Start with the code where Directcast works. Look above those lines to see where eventargs is defined or is passed to the call.

Remember you are using Aforge's addons so they get to document how to use.

dr i tried this modification referring to Aforge documentation but i reamins erronned
qdf.png

Not what I asked you to try. I said start with a working example so you can see where the Aforge stuff is used.
In your last reply you seem to have repeated the use of DirectCast without setting up to use their stuff.

I think we made minor progress with changes to using Form.Load to autorun your code and the timer to do what you want in the timer loop.

But to use a library like Aforge, that's where you get them to tell you more if they didn't document the library's use.

i really thank you deeply dr for the help :) im searching more for a solution and if you have any suggestion about new method or thing like this do no hesitate to help me :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.