# Monochrome64 pixel data

**URL:** <https://forum.commonvisionblox.com/t/monochrome64-pixel-data/757>\
**Category:** .Net API\
**Created:** [May 9, 2019, 12:00pm UTC](https://forum.commonvisionblox.com/t/monochrome64-pixel-data/757 "2019-05-09T12:00:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![BenDevos](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/bendevos/32/490_2.png) [@BenDevos](https://forum.commonvisionblox.com/u/BenDevos)\
**Post date:** [May 9, 2019, 12:00pm UTC](https://forum.commonvisionblox.com/t/monochrome64-pixel-data/757/1 "2019-05-09T12:00:16Z")

</div>

Hello,

I use a Dalsa Genie Nano with special firmware for LineProfiler this outputs a 64bits/pixel.  
 ![image](https://canada1.discourse-cdn.com/flex027/uploads/commonvisionblox/original/1X/c1a75cc3daddcdb2b1f7cd84f1ee92d5dad97ae3.png)

But in the Plane information I only get 8 bits per pixel.  
Is this supported? I see there is a Float64Bpp datatype?

---

<div class="post-metadata">

**Author:** ![guest24](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/guest24/32/150_2.png) [@guest24](https://forum.commonvisionblox.com/u/guest24)\
**Post date:** [May 9, 2019, 1:28pm UTC](https://forum.commonvisionblox.com/t/monochrome64-pixel-data/757/2 "2019-05-09T13:28:02Z")

</div>

Hi @BenDevos  
how did you configure the PixelFormat (in the GenICam Browser: CVB Color Format) of the GenICam.vin driver?  
It need to be set to RAW ( = 0). Other wise CVB tries to convert the pixel values to 8bit.

_One further piece of advice: To get the best performance (high framerate) you might consider turning of the cvb logging, as each line is transmitted separatly_

---

<div class="post-metadata">

**Author:** ![BenDevos](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/bendevos/32/490_2.png) [@BenDevos](https://forum.commonvisionblox.com/u/BenDevos)\
**Post date:** [May 9, 2019, 1:44pm UTC](https://forum.commonvisionblox.com/t/monochrome64-pixel-data/757/3 "2019-05-09T13:44:21Z")

</div>

This is indeed set to RAW, still 8bpp in the LinearAccess

Where do you disable this logging?

---

<div class="post-metadata">

**Author:** ![guest24](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/guest24/32/150_2.png) [@guest24](https://forum.commonvisionblox.com/u/guest24)\
**Post date:** [May 9, 2019, 2:12pm UTC](https://forum.commonvisionblox.com/t/monochrome64-pixel-data/757/4 "2019-05-09T14:12:23Z")

</div>

In that case just use the base pointer and manually access each pixel with xInc = 8  
The values you are looking for should be accessable by:

```auto
intptr_t elementPtr= basePtr+ i*xInc;
uint8_t valAntiScatter = *(uint8_t*)(elementPtr);
uint8_t valScatter = *(uint8_t*)(elementPtr+ 1);
uint32_t valWeightedColSum = *(uint32_t*)(elementPtr+ 2);
uint16_t valPixSum = *(uint16_t*)(elementPtr+ 6);

```

Please note that to work with 64bit pixel data CVB requires a VIN- and Socket-Driver of at least the following versions:

- GenICam.vin version 2.0.17.1018
- GEVSD.dll version 2.11.0.448

Use the LogGUI application to adjust the logging (available since CVB 13.0)

---

<div class="post-metadata">

**Author:** ![BenDevos](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/bendevos/32/490_2.png) [@BenDevos](https://forum.commonvisionblox.com/u/BenDevos)\
**Post date:** [May 9, 2019, 2:32pm UTC](https://forum.commonvisionblox.com/t/monochrome64-pixel-data/757/5 "2019-05-09T14:32:31Z")

</div>

From basePtr on there are only 640 bytes (width) with a value. After that they are all zero.

---

<div class="post-metadata">

**Author:** ![guest24](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/guest24/32/150_2.png) [@guest24](https://forum.commonvisionblox.com/u/guest24)\
**Post date:** [May 10, 2019, 8:25am UTC](https://forum.commonvisionblox.com/t/monochrome64-pixel-data/757/6 "2019-05-10T08:25:46Z")

</div>

Did you remember to switch Std::DeviceScanType to Linescan3D starting the grab and accessing basePtr?  
If that wasn’t the cause, could you post your GenICam.vin configuration (%CVBDATA%Drivers/GenICam.ini)

---

<div class="post-metadata">

**Author:** ![BenDevos](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/bendevos/32/490_2.png) [@BenDevos](https://forum.commonvisionblox.com/u/BenDevos)\
**Post date:** [May 10, 2019, 8:51am UTC](https://forum.commonvisionblox.com/t/monochrome64-pixel-data/757/7 "2019-05-10T08:51:27Z")

</div>

Thanks Guest24 for your information!  
I used the DeviceFactory.Discover() wich selected the wrong device information.  
When I get the device from Vin and port number it works.

depending what work stations are active I want to prioritize some camera’s. (12 in total)  
So the DeviceFactory is really handy together with Linq:

```auto
var username = d.SingleOrDefault(u => u.Key.Equals(DiscoveryProperties.DeviceUsername));

```

Can I set the CVB Color Format to RAW at runtime?

---

<div class="post-metadata">

**Author:** ![BenDevos](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/bendevos/32/490_2.png) [@BenDevos](https://forum.commonvisionblox.com/u/BenDevos)\
**Post date:** [May 10, 2019, 9:03am UTC](https://forum.commonvisionblox.com/t/monochrome64-pixel-data/757/8 "2019-05-10T09:03:43Z")

</div>

d.SetParameter(“PixelFormat”, “0”); in my foreach loop does the trick.

Thanks again guest24!

---

<div class="post-metadata">

**Author:** ![parsd](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/parsd/32/7_2.png) [@parsd](https://forum.commonvisionblox.com/u/parsd)\
**Post date:** [May 10, 2019, 11:51am UTC](https://forum.commonvisionblox.com/t/monochrome64-pixel-data/757/9 "2019-05-10T11:51:34Z")

</div>

I totally agree regarding Linq ❤: I often use an extension class for that case (which I extended for your raw use case) that can be used like this:

```auto
using (var deviceInfos = DeviceFactory.Discover())
{
  var device = deviceInfos.OpenDeviceByUsername("TheUsername", OpenRaw.Yes);

  ...
}

```

And here is the class:

```auto
enum OpenRaw
{
  No,
  Yes
}

static class DeviceFactoryExtensions
{
  public static Device OpenDeviceByUsername(this DiscoveryInformationList deviceInfos, string usernameToOpen, OpenRaw openRaw = OpenRaw.No)
  {
    if (deviceInfos == null)
      throw new ArgumentNullException(nameof(deviceInfos));
    if (usernameToOpen == null)
      throw new ArgumentNullException(nameof(usernameToOpen));
	
    var deviceInfo = deviceInfos.First(di => di.GetUsername() == usernameToOpen);
		
    if(openRaw == OpenRaw.Yes)
      deviceInfo.SetParameter("PixelFormat", "0");
		
    return DeviceFactory.Open(deviceInfo);
  }

  public static string GetUsername(this DiscoveryInformation di)
  {
    if(di.TryGetProperty(DiscoveryProperties.DeviceUsername, out var username))
      return username;
    else
      return string.Empty;
  }
}

```
