Hey there friends! I need your help in SD card and image;
It's been a week since I have involved with this problem so i wish you can help me.
here is the problem:
I saved a photo to the SD card and now I want to read the color information of each pixel and put the servo in a definite position based of the pixel color.
I want to read pixel by pixel information in a row and after completing a row reed the next row.
The image has 2000*2000 pixel.
Well, is there a solution to these circumstances
I can convert the photo in any format
I can also take photo information as a CSV file with 2000 row and 2000 column
The .BMP format is very easy to process. However there are many different BMP formats e.g.
24-bit colour i.e. 3 bytes per pixel RGB
8-bit colour i.e. 1 byte per pixel. The actual colour is stored in a Colour Palette.
You can convert from one format style to another on your PC with IrfanView or similar.
IrfanView can even arrange Colour Palettes in Colour or Frequency.
So it is quite easy to access an individual pixel from a particular BMP file. The header gives you the information. You can seek to an individual pixel in the SD file.
You either get the RGB directly or from the Palette.
It is unlikely that you will operate a Servo with 16 million positions.
But you might operate a Servo for 256 positions of RED. Or for average colour intensity. (brightness)
Your BMP is 12MB as 24-bit. Or 4MB as 8-bit Palette. Size does not matter on a SD card.
BMP is easy to process. JPG requires decoding. A Uno can not decode JPG. But Mega2560, Zero, Due, STM32, ESP8266, ... all can.
david_prentice:
The .BMP format is very easy to process. However there are many different BMP formats e.g.
24-bit colour i.e. 3 bytes per pixel RGB
8-bit colour i.e. 1 byte per pixel. The actual colour is stored in a Colour Palette.
You can convert from one format style to another on your PC with IrfanView or similar.
IrfanView can even arrange Colour Palettes in Colour or Frequency.
So it is quite easy to access an individual pixel from a particular BMP file. The header gives you the information. You can seek to an individual pixel in the SD file.
You either get the RGB directly or from the Palette.
It is unlikely that you will operate a Servo with 16 million positions.
But you might operate a Servo for 256 positions of RED. Or for average colour intensity. (brightness)
Your BMP is 12MB as 24-bit. Or 4MB as 8-bit Palette. Size does not matter on a SD card.
BMP is easy to process. JPG requires decoding. A Uno can not decode JPG. But Mega2560, Zero, Due, STM32, ESP8266, ... all can.
David.
thanks dear David
in my picture i just have 100 color.
is there any code that can show me how reference every single pixel?
Open your photo in IrfanView. You can process the image on your PC. Store it on the SD card.
Since you only have 100 colours you can use a Colour Palette.
david_prentice:
Open your photo in IrfanView. You can process the image on your PC. Store it on the SD card.
Since you only have 100 colours you can use a Colour Palette.
dear David is there any specific library to access the pixel location and value?