- Occupancy grid mapping for dummies 64 Bit#
- Occupancy grid mapping for dummies 32 bit#
- Occupancy grid mapping for dummies code#
The usual way to store an image in memory is to store its pixels one by one, row by row. Pixman, undoubtedly inheriting it from X11 pixel format definitions, is the only place where I have seen that. It is also possible, though extremely rare, that architecture endianess also affects the order of bits in a byte. That is, abgr8888 has r in bits 0-7, g in bits 8-15, etc. The writing convention here is to list channels from highest to lowest bits in a unit. Three equivalent pixel formats with 8 bits for each channel. Figure 1 shows three different pixel format definitions that produce identical binary data in memory.įigure 1. This is important to remember when you are mapping one set of pixel formats to another, between OpenGL and anything else, for instance. If you have two pixel formats, one written in array of bytes form and one written in bits in a unit form, and they are equivalent on big-endian architecture, then they will not be equivalent on little-endian architecture. The difference between an array of bytes and bits in a unit is the CPU architecture endianess. A 32 bits per pixel format has a unit of 32 bits, that is uint32_t in C parlance, for instance. When decoding a pixel format, you first have to understand if it is referring to an array of bytes (particularly used when each channel is 8 bits) or bits in a unit. How channels are packed in a pixel is specified by the pixel format. The usual RGB-image therefore has 32 bits per pixel and a depth of 24 bits. The term "depth" is often used to describe how many significant bits a pixel uses, to distinguish from how many bits or bytes it occupies in memory.
Occupancy grid mapping for dummies code#
True 24 bits per pixel formats are rarely used in memory because trading some memory for simpler and more efficient code or circuitry is almost always a net win in image processing.
Occupancy grid mapping for dummies 32 bit#
Your usual RGB-image with 8 bits per channel is most likely in memory with 32 bit pixels, the extra 8 bits per pixel are simply unused (often marked with X in pixel format names).
Occupancy grid mapping for dummies 64 Bit#
32 and 16 bit quantities are easy and efficient to process on 32 and 64 bit CPUs. A pixel is usually 32 or 16 bits, or 8 or even 1 bit. For example, rgb565 format is 16 bits per pixel, 2 bytes per pixel, 5 bits per R and B channels, and 6 bits per G channel. Also bits per channel is used sometimes, and channels can have a different number of bits per pixel each. Both can be abbreviated as "bpp", so be careful which one it is and favour more explicit names in code. When describing how much memory a pixel takes, one can use units of bits or bytes per pixel. Each of R, G, B, and A is called a channel. The relevant thing is that each of them is encoded with a certain number of bits. What R, G, B, and A actually mean is irrelevant when looking at how they are stored in memory. If opacity (or occupancy) exists, it is usually called "alpha" or A. Color is usually described as three numerical values, let us call them "red", "green", and "blue", or R, G, and B. An image has a width and height measured in pixels, and the total number of pixels in an image is obviously width× height.Ī pixel can be addressed with coordinates x,y after you have decided where the origin is and which way the coordinate axes go.Ī pixel has a property called color, and it may or may not have opacity (or occupancy). An image, or more precisely, an uncompressed raster image, consists of a rectangular grid of pixels. Wikipedia explains the concept of raster graphics, so let us take that idea as a given. So, I decided to write it down myself with the things I see as essential. I tried to find a web page for dummies explaining all that, and all I could find was this. How is an uncompressed raster image laid out in computer memory? How is a pixel represented? What are stride and pitch and what do you need them for? How do you address a pixel in memory? How do you describe an image in memory?