PDA

View Full Version : Video capturing and image processing at same time



zihui
March 7, 2006, 11:38:31
i am using the "ImageAvailable" event to processing every frame. Now I want to capture a video clip at same time. the video clip is about 10seconds (i useing timer to control it).

The problem encountered is that the live image looks like freezing during the video capturing.

Is a way to do the video capturing and image processing at same time with a same channel? If so, how?

Thanks


'~~~~~~~~~~~~~~~~~~~~~~~
Here is my vb.net code:

ICControl = IcImagingControl1

Private Sub IcImagingControl1_ImageAvailable(ByVal sender As Object, ByVal e As TIS.Imaging.ICImagingControl.ImageAvailableEventAr gs) Handles IcImagingControl1.ImageAvailable
Try
CurrentBuffer.Unlock()
CurrentBuffer = IcImagingControl1.ImageBuffers(e.bufferIndex)
CurrentBuffer.Lock()
ImageProcessing()
Catch ex As Exception
System.Diagnostics.Trace.WriteLine(ex.Message)
End Try
End Sub

Private Sub tmrEvent_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrEvent.Tick
tmrEvent.Enabled = False
tmrEvent.Interval = 10000
'ICControl.AviStopCapture()
ICControl.AviStartCapture(CurDir() & "\temp.avi", cboVideoCodec.SelectedItem)
tmrEvent.Enabled = True
End Sub
'~~~~~~~~~~~~~~~~~~~~~~~

Stefan Geissler
March 7, 2006, 16:30:01
Hello,

Image processing and video capture can not be done the way you want to do this. The only way to combine both is using a frame filter for image processing.
Please refer to:
http://www.imagingcontrol.com/ic/docs/html/dotnet/Binarization.htm

and for the frame filter wizard:
http://www.imagingcontrol.com/ic/docs/html/dotnet/tech_wizards_framefilterclass.htm

zihui_w
March 8, 2006, 09:20:05
Hi Stefan,

Thank you for your prompt reply. Do you have any vb.net sample code of doing this way?

Regards

Zihui

Stefan Geissler
March 8, 2006, 09:29:28
Hello Zihui,

I am sorry, but there is no sample. I suggest to use the "Capturing an AVI File" and simply add a frame filter directly after the device. You may use one of the standard filter modules for testing, e.g. the ROI filter. Then you can write your own filter module or filter class and insert it instead of the ROI filter.
If you have problem with this, please let me know, so i could do this for you.

zihui_w
March 9, 2006, 16:31:43
hi stefan,

thank you so much for your kind reply.

i can capture the video clip using the sample code "capturing an avi file". but i don't know how to add the filter module in?

Could you write a peice of vb.net sample code for my reference.

Best Regards

Zihui

Stefan Geissler
March 9, 2006, 17:24:05
Hello Zihui,

Please take the "Capturing an AVI File" sample. Please enhance the Form_Load sub as follows:


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IcImagingControl1.DeviceValid Then
IcImagingControl1.ShowDeviceSettingsDialog()

If Not IcImagingControl1.DeviceValid Then
MessageBox.Show("No device was selected.", "Capturing an AVI File")
Me.Close()
Exit Sub
End If
Dim Filter As TIS.Imaging.FrameFilter
Filter = IcImagingControl1.FrameFilterCreate("ROI", "")
Filter.SetIntParameter("Width", 100)
Filter.SetIntParameter("Height", 100)
IcImagingControl1.DeviceFrameFilters.Add(Filter)
End If
End Sub

This sample loads the ROI filter module. The width and height is set to 100 pixel. Now you can capture an AVI file. The picture size of the AVI file has 100 * 100 pixels. If you want to acces the filter later, then you should move the line


Dim Filter As TIS.Imaging.FrameFilter

on top of the form, so it is global. If you have tested this, you can use the FrameFilter wizard (available for C++ and C#) to create your own frame filter. In this frame filter your image processing is done. If you need help for the frame filter itself and you do not want to do this in public, please send a request to support@imagingcontrol.com

zihui_w
March 10, 2006, 05:01:41
Hi Stefan,

Thank you very much. I have tried your sample code. There is an error to add "Dim Filter As TIS.Imaging.FrameFilterut". In my TIS.Imaging component, no "FrameDilterut" class at all. What should i do? Any components i missed out? I am using IC Imaging Control 2.1.

When i add "ICFilterContainer.dll" in vb.net. an error bos is shown.

The error is:

"A reference to "C:\Program files\The Imaging Source Europe GmbH\IC Imaging Control 2.1\Bin\ICFilterContainer.dll" could not be added. This is not a valid assembly or COM component. .........

Again, Thanks for your reply.

Zihui

Stefan Geissler
March 10, 2006, 09:59:05
Hello Zihui

The FramFilter class is available in IC Imaging Control 3.0. With 2.1 you can not do what you want. You may write a request to support@imagingcontrol.com, so i can send you a free update.