PDA

View Full Version : multi proces



elia
August 30, 2006, 09:16:58
Hi,
I would want to use two parallel proces (using visual basic 6):
The first process captures a still image from a live video stream and stores it in an internal buffer.
The second proces read the image from the buffer and write it into the hard disk. (camera DFK 31BF03)
It's possible using visual basic 6?
it's possible to have a simple example?


Thanks

Stefan Geissler
August 30, 2006, 09:38:11
Hi elia,

I am not sure how to start two processe in VB6, but why do you want to use two processes for this? This can be done in one process.

elia
August 30, 2006, 10:24:35
I would want to use two processes for to increase the performances of my sistem.
I have cameras 3(DFK 31BF03)(BY8 1024x768) and every camera is connected to a single FireWire bus and the frame rate selected
is 15 frame/sec (no trigger mode).
My vb6 code is:

On Error GoTo cmdSaveBitmap_Click

Percorso = App.Path & "\" & Format(Now(), "yyyymmddhhmmss") & "\"
MkDir Percorso

For i = 1 To 100

ICImagingControl1.MemorySnapImage
CurrentBuffer = ICImagingControl1.ImageBuffers.CurrentIndex
ICImagingControl1.ImageBuffers.Item(CurrentBuffer) .SaveAsJpeg Percorso & "img_" & Format(i, "000") & "index_buffer" & CurrentBuffer & "_1.jpg", 55

ICImagingControl2.MemorySnapImage
CurrentBuffer2 = ICImagingControl2.ImageBuffers.CurrentIndex
ICImagingControl2.ImageBuffers.Item(CurrentBuffer2 ).SaveAsJpeg Percorso & "img_" & Format(i, "000") & "index_buffer" & CurrentBuffer & "_2.jpg", 55

ICImagingControl3.MemorySnapImage
CurrentBuffer3 = ICImagingControl3.ImageBuffers.CurrentIndex
ICImagingControl3.ImageBuffers.Item(CurrentBuffer3 ).SaveAsJpeg Percorso & "img_" & Format(i, "000") & "index_buffer" & CurrentBuffer & "_3.jpg", 55

Next

MsgBox "End"

Exit Sub

cmdSaveBitmap_Click:
If Err <> cdlCancel Then
' MsgBox Err.Description
End If

I would want to use two processes for stored a frame in the buffer(ICImagingControl1.MemorySnapImage)
and at the same time wrire the image previously stored in the hard disc (ICImagingControl3.ImageBuffers.Item(CurrentBuffer-1).SaveAsJpeg).

Currently for complite the acquisition of 100 image the time is 29 sec.

It's possible reduce this time?

thanks

Stefan Geissler
August 31, 2006, 08:09:40
Hello Elia,

The reason why your application is so slow is in the call of ICImagingControl1.MemorySnapImage.
ICImagingControl1.MemorySnapImage starts the live stream before an image is snapped if the live video has not been started previously. This is very time consuming.
You may try following:


On Error GoTo cmdSaveBitmap_Click

Percorso = App.Path & "\" & Format(Now(), "yyyymmddhhmmss") & "\"
MkDir Percorso
ICImagingControl1.LiveStart
ICImagingControl2.LiveStart
ICImagingControl3.LiveStart

For i = 1 To 100
ICImagingControl1.MemorySnapImage
CurrentBuffer = ICImagingControl1.ImageBuffers.CurrentIndex
ICImagingControl1.ImageBuffers.Item(CurrentBuffer) .SaveAsJpeg Percorso & "img_" & Format(i, "000") & "index_buffer" & CurrentBuffer & "_1.jpg", 55

ICImagingControl2.MemorySnapImage
CurrentBuffer2 = ICImagingControl2.ImageBuffers.CurrentIndex
ICImagingControl2.ImageBuffers.Item(CurrentBuffer2 ).SaveAsJpeg Percorso & "img_" & Format(i, "000") & "index_buffer" & CurrentBuffer & "_2.jpg", 55

ICImagingControl3.MemorySnapImage
CurrentBuffer3 = ICImagingControl3.ImageBuffers.CurrentIndex
ICImagingControl3.ImageBuffers.Item(CurrentBuffer3 ).SaveAsJpeg Percorso & "img_" & Format(i, "000") & "index_buffer" & CurrentBuffer & "_3.jpg", 55
Next

ICImagingControl1.LiveStop
ICImagingControl2.LiveStop
ICImagingControl3.LiveStop

MsgBox "End"

Exit Sub

cmdSaveBitmap_Click:
If Err <> cdlCancel Then
' MsgBox Err.Description
End If

In this code, the live stream is started only once instead of 100 times.