Getting A pointer to the first Pixel of the Image without Instantiating a Collection #1786
-
Is there any way to get a Pointer to the First Pixel in the image without actually Materializing a Collection of Pixels? I know how to do this in System.Drawing and in OpenCV but I either don't know how or I'm doing it wrong in Image Magick. E.G. (for OpenCV Mat's).
(for BitmapData bmp)
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
With |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply! I understand that much, and I may not be doing it right but it seems to me that I cannot call that method (GetAreaPointer) on a MagickImage, I have to actually create a Collection of Pixels as a Precondition to getting the Pointer. E.G.
but this is wasteful because I am materializing Millions or even 10's of Millions of Pixels each with several channels when I am not interested at all in the collection, only the memory address of the first Pixel. (From there I can calculate Offsets.)
which is very convenient because it doesn't make me get a UShort Array or a Byte Array of the Pixels in order to get a reference. Or is there a way to call GetAreaPointer or something similar on the MagickImage instead of on a PixelCollection? |
Beta Was this translation helpful? Give feedback.
There is no iteration happening. You are only getting an api to access the pixels. I have now tried to explain this multiple times but I am not sure what kind of wording I should use to make this clear to you. The
PixelCollection
isIEnumerable
but the pixels will only be iterated when you are doing that yourself. TheGetAreaPointer
method returns your a pointer to the native pixel area that you specified.