Working with 3D-Cameras of Automation Technology in CVB

Hi support team,
When I use this method, how can I get imgDC0, imgDC1 and imgDC2 pointer?
If using
Dim imageDataDC1 As LinearAccessData = imgDC1 .Planes(0).GetLinearAccess()
Dim basePtrDC1 As IntPtr = imageDataDC1.BasePtr
the error will occure at GetLinearAccess().

Thank you for your support.

Hi @Charlene,

What kind of error do you get? If it is an exception, the documentation might give you a hint:

FormatException If the plane’s pixels are not accessible linearly
System.ObjectDisposedException If Parent has already been disposed
InvalidOperationException Thrown if the size of T and DataType.BytesPerPixel are unequal.

If you get the LinearAccessData keep following in mind:
For Visual Basic .Net you need to use the helper functions provided in the System.Runtime.InteropServices.Marshal class for the increments.

Hi @Sebastian

When I use
Dim rect As New Rect(0, 1, img.Width - 1, img.Height - 1)
Image = img.Map(rect, Size)
Dim imageData As LinearAccessData = Image.Planes(0).GetLinearAccess() 'the error is at this line
Dim basePtr As IntPtr = imageData.BasePtr
it will show the error:
Message=Operation Linear Access only supported on linear VPATs.

The problem should be the pixel is skipping. It is non-linear.
Can we use GetImageVPA() to get non-linear mapped image pointer?
Which function of CVB.Net can be used?

Thank you for your reply.

In the ImagePlane you can use the GetVPATAccess() function to access the VPAT access to the plane´s pixels.

Hi @Sebastian
Could you give me a example how to use GetVPATAccess()?
I am not familier with the code how to use GetVPATAccess().
I cannot find out CVB sample to use this function.

Thank you.


Have a look at the little example below. This should explain how to access the VPAT Access Data.

var device = DeviceFactory.Open(@"%CVB%Drivers\");

for(int i = 0; i < 10; i++)
    var image = device.Stream.Wait();
    var vpaAccessData = image.Planes[0].GetVPATAccess<byte>();

    Console.WriteLine(vpaAccessData[500, 500]);

Furthermore, here is a link for the CVB Online Documentation
( ), or if more precisely needed the GetVPATAccess Method ( )

Thanks and regards

Hi @silas
Thanks for your promp answer.
How can I convert vpaAccessData to “IntPtr” data type so that I can convert CVB image format to other image format?

Yours sincerely


You can achieve that by simply using the VPAT from the image plane and getting the corresponding Base Pointer.

var vpat = image.Planes[0].Vpat; 
IntPtr vpatPtr = vpat.BasePtr;


I´ve come to a possible workaround regarding the VPAT Access. If you either copy or clone the image you´ll be able to do linear access on the copied/cloned image and avoid VPAT access.
Note that VPAT access is one of the slower access modes, so linear access is preferred.

var copiedImage = image.Copy();
var clonedImage = image.Clone();    


1 Like

It works now.

Yours sincerely

1 Like