Hello @MoDiver,
when you say ringbuffer control do you mean the ActiveX control? You also seem to use the object oriented wrappers. Then you don’t need the ActiveX controls. We don’t have many VB.Net users, this is why we don’t have examples. Sorry. Still I recommend reading:
https://forum.commonvisionblox.com/t/getting-started-with-cvb-net/246?u=parsd
The C# in there is easily translated to VB.Net as the objects are the same. There also the ring buffer is explained.
PanoramicImage
I start with the code:
Sub AcquisitionLoop(device As Device)
Dim stream = device.Stream
stream.RingBuffer.LockMode = RingBufferLockMode.On
stream.RingBuffer.ChangeCount(6, DeviceUpdateMode.UpdateDeviceImage)
stream.Start()
Dim lastImage As StreamImage = Nothing
Try
While True
Dim newImage = stream.Wait()
If lastImage IsNot Nothing Then
ProcessImages(lastImage, newImage)
End If
If lastImage IsNot Nothing
lastImage.Dispose()
End If
lastImage = newImage
End While
Finally
If lastImage IsNot Nothing
lastImage.Dispose()
End If
stream.Abort()
End Try
End Sub
Sub ProcessImages(imageTop As Image, imageBottom As Image)
Dim combinedImage = PanoramicMappedImage.CreateVertical(imageTop, imageBottom)
YourSearch(combinedImage)
End Sub
You store your previous image and process then two at once without copying any data. To be able to do that you need to increase the ring buffer size and change the lock mode to manual (LockMode.On
). The size increase is necessary to prevent loosing frames. And you now need to explicitly unlock your unused images via .Dispose()
. If you don’t do that your ring buffer runs out of usable memory and your application blocks in the .Wait
call.
Image to Bitmap
Just add the reference to Stemmer.Cvb.Extensions.dll to your project and make sure that you import the namespace Stemmer.Cvb.Extensions
. Then you can simply call .ToBitmap()
on a Stemmer.Cvb.Image
.
I hope that helps.