0

Using a GenICam SDK to retrieve camera images. The SDK has a class for getting image information from a buffer. The image instance has a property called DataPointer:

Values of an actual image buffer

I understand generally that a datapointer points to a instance's location in memory. Beyond that I know very little since all my experience is in managed systems (C#, VB and others). The image is supposed to be 14 bits per pixel and 512 x 640 = 327,680 pixels.

I am assuming that the pixels are in sequential order row by row in memory starting at 0x000001e6e2ad2040 in the above example.

Something that does not make sense to me is if the effective image size is 1310720 then taking EffectiveImageSize/Pixes = 4. I did not expect this.

How would I retrieve the pixels values of the above image?

Eric Snyder
  • 1,816
  • 3
  • 22
  • 46
  • An API usually comes with examples. How are you calling this API, is it a managed API, or a native one called via interop? – 500 - Internal Server Error Jul 03 '19 at 19:45
  • It's probably 14-bits-per-*channel*, not per pixel. You'll need to read the SDK documentation on the image format in use. I assume its RAW, but that's only a guess. –  Jul 03 '19 at 20:05
  • In regards to the `EffectiveImageSize/Pixes` being 4, this is the number of bytes per pixel, which makes sense since the `BitsPerPixel` is 32 (or 4 bytes) or 3 channels at 14 bits/channel – amura.cxg Jul 03 '19 at 20:11
  • @500 - Internal Server Error - No example in the docs on this. I think they assume the reader understands. My guess is that most people use C++ with this SDK. – Eric Snyder Jul 03 '19 at 20:28
  • @amura.cxg - that makes sense. Now, how to read them? – Eric Snyder Jul 03 '19 at 20:30
  • @Eric Could you link to the documentation? –  Jul 03 '19 at 20:51
  • @Eric Is `DataPointer` an `IntPtr`? –  Jul 03 '19 at 20:56
  • @Amy - Not really. They don't allow the download until you buy. The doc is a chm document. I can link parts though. The Image.DataPointer says "Gets the buffer's data pointer. public byte* DataPointer { get; }". Nothing else of substance. Most of the docs are pretty good though. – Eric Snyder Jul 03 '19 at 20:57
  • @Eric Okay, well, the issue is you need to know the image format before you can decode it from memory. Do you know if it is greyscale or color, at least? You might consider looking at ImageMagick loading from a memory pointer; ImageMagick has support for a plethora of image formats and might work "automagically". https://github.com/dlemstra/Magick.NET/blob/master/docs/Readme.md –  Jul 03 '19 at 21:07
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/195953/discussion-between-eric-and-amy). – Eric Snyder Jul 03 '19 at 21:55

0 Answers0