# Working with 3D-Cameras of Automation Technology in CVB

**URL:** <https://forum.commonvisionblox.com/t/working-with-3d-cameras-of-automation-technology-in-cvb/532>\
**Category:** Programming Questions\
**Tags:** acquisition, genicam, gigevision, documentation\
**Created:** [August 23, 2018, 9:42am UTC](https://forum.commonvisionblox.com/t/working-with-3d-cameras-of-automation-technology-in-cvb/532 "2018-08-23T09:42:09Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![Charlene](https://avatars.discourse-cdn.com/v4/letter/c/eada6e/32.png) [@Charlene](https://forum.commonvisionblox.com/u/Charlene)\
**Post date:** [March 6, 2023, 9:22am UTC](https://forum.commonvisionblox.com/t/working-with-3d-cameras-of-automation-technology-in-cvb/532/22 "2023-03-06T09:22:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Sebastian](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/sebastian/32/1267_2.png) [@Sebastian](https://forum.commonvisionblox.com/u/Sebastian)\
**Post date:** [March 7, 2023, 10:38am UTC](https://forum.commonvisionblox.com/t/working-with-3d-cameras-of-automation-technology-in-cvb/532/23 "2023-03-07T10:38:56Z")

</div>

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](https://help.commonvisionblox.com/NextGen/14.0/cvbnet/dd/d75/struct_stemmer_1_1_cvb_1_1_data_type.html#ac03e9645c1f500c1040a8d525bb00611) 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.

---

<div class="post-metadata">

**Author:** ![Charlene](https://avatars.discourse-cdn.com/v4/letter/c/eada6e/32.png) [@Charlene](https://forum.commonvisionblox.com/u/Charlene)\
**Post date:** [March 8, 2023, 7:08am UTC](https://forum.commonvisionblox.com/t/working-with-3d-cameras-of-automation-technology-in-cvb/532/24 "2023-03-08T07:08:05Z")

</div>

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:  
System.ArgumentException  
HResult=0x80070057  
Message=Operation Linear Access only supported on linear VPATs.  
Source=Stemmer.Cvb

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](http://CVB.Net) can be used?

Thank you for your reply.

---

<div class="post-metadata">

**Author:** ![Sebastian](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/sebastian/32/1267_2.png) [@Sebastian](https://forum.commonvisionblox.com/u/Sebastian)\
**Post date:** [March 8, 2023, 12:23pm UTC](https://forum.commonvisionblox.com/t/working-with-3d-cameras-of-automation-technology-in-cvb/532/25 "2023-03-08T12:23:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Charlene](https://avatars.discourse-cdn.com/v4/letter/c/eada6e/32.png) [@Charlene](https://forum.commonvisionblox.com/u/Charlene)\
**Post date:** [March 9, 2023, 3:30am UTC](https://forum.commonvisionblox.com/t/working-with-3d-cameras-of-automation-technology-in-cvb/532/26 "2023-03-09T03:30:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![silas](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/silas/32/881_2.png) [@silas](https://forum.commonvisionblox.com/u/silas)\
**Post date:** [March 9, 2023, 2:03pm UTC](https://forum.commonvisionblox.com/t/working-with-3d-cameras-of-automation-technology-in-cvb/532/27 "2023-03-09T14:03:11Z")

</div>

@Charlene  
Hey!

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

```cs
var device = DeviceFactory.Open(@"%CVB%Drivers\GenICam.vin");
             
device.Stream.Start();

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

    Console.WriteLine(vpaAccessData[500, 500]);
}
device.Stream.Abort();

```

Furthermore, here is a link for the CVB Online Documentation  
( [https://help.commonvisionblox.com/NextGen/14.0/index.html](https://help.commonvisionblox.com/NextGen/14.0/index.html) ), or if more precisely needed the GetVPATAccess Method ( [https://help.commonvisionblox.com/NextGen/14.0/cvbnet/d6/df0/struct\_stemmer\_1\_1\_cvb\_1\_1\_image\_plane.html#a988c5eddc936b27b3d91c776a8a22bab](https://help.commonvisionblox.com/NextGen/14.0/cvbnet/d6/df0/struct_stemmer_1_1_cvb_1_1_image_plane.html#a988c5eddc936b27b3d91c776a8a22bab) )

Thanks and regards  
Silas

---

<div class="post-metadata">

**Author:** ![Charlene](https://avatars.discourse-cdn.com/v4/letter/c/eada6e/32.png) [@Charlene](https://forum.commonvisionblox.com/u/Charlene)\
**Post date:** [March 10, 2023, 7:41am UTC](https://forum.commonvisionblox.com/t/working-with-3d-cameras-of-automation-technology-in-cvb/532/28 "2023-03-10T07:41:11Z")

</div>

> [@silas](#):
>
> `vpaAccessData `

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  
Charlene

---

<div class="post-metadata">

**Author:** ![silas](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/silas/32/881_2.png) [@silas](https://forum.commonvisionblox.com/u/silas)\
**Post date:** [March 10, 2023, 12:12pm UTC](https://forum.commonvisionblox.com/t/working-with-3d-cameras-of-automation-technology-in-cvb/532/29 "2023-03-10T12:12:34Z")

</div>

@Charlene  
Hey!

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

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

```

Regards  
Silas

---

<div class="post-metadata">

**Author:** ![silas](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/silas/32/881_2.png) [@silas](https://forum.commonvisionblox.com/u/silas)\
**Post date:** [March 14, 2023, 8:44am UTC](https://forum.commonvisionblox.com/t/working-with-3d-cameras-of-automation-technology-in-cvb/532/30 "2023-03-14T08:44:02Z")

</div>

@Charlene  
Hey!  
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.

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

```

Regards  
Silas

---

<div class="post-metadata">

**Author:** ![Charlene](https://avatars.discourse-cdn.com/v4/letter/c/eada6e/32.png) [@Charlene](https://forum.commonvisionblox.com/u/Charlene)\
**Post date:** [March 21, 2023, 8:47am UTC](https://forum.commonvisionblox.com/t/working-with-3d-cameras-of-automation-technology-in-cvb/532/31 "2023-03-21T08:47:03Z")

</div>

@silas  
Thanks.  
It works now.

Yours sincerely  
Charlene

[Previous page](https://forum.commonvisionblox.com/t/working-with-3d-cameras-of-automation-technology-in-cvb/532.md?page=1)
