Click on Join Now to Sign Up
I am building a program for steering my robot and mapping the environment.
My question is about drawing and storing the map.
What I want:
My approach would be to create a 1000x1000 byte array (store not scanned, clear, blocked).
If I want to rotate the map, I need to recalculate position of each pixel.
If I zoom I read only a smaller portion of the array and draw dots with arrayvalue*zoom in size.
I store the map in a csv (all array values). I could also store only scanned points. But as I would need store position, the amount of date would be equal or even more.
Is this the best or at least a good approach? Does someone has tips or a demo project?
I am trying to display an image I receive via serial. I submit different color depths.
The code is below reacts on:
g_grayscaleImage == 0 // 16 bit rgb
g_grayscaleImage == 1 // 8 bit grayscale
g_grayscaleImage == 2 // 4 bit grayscale
The code works fine for 16 and 8 bit. With 4 bit I don’t get the pixels to the right position. (so the part from "else if (g_grayscaleImage==2)" doesn't work)
The “best” result I got with the code below. It looks like this:
Does someone see the mistake and can help me out?
Here the code: