2014-04-11 02:21 AM
Guys,
Does anyone of you have experience on decoding bmp ? I want to display bmp file to my LCD... Any clues ? thanks #i-have-a-clue2014-04-18 08:19 PM
do you have example for it ? thanks
Like all of these I'd have to write one, do you have a sample 24-bit 320x240 image as a reference?2014-04-18 08:42 PM
// For the specific BMP, 24-bit per pixel
// sourcer32@gmail.com
void bmp24(void)
{
int i, x, y, xx, yy;
uint8_t hdr[0x36];
uint32_t off;
UINT bytesread;
res = f_open(&fsrc, ''testbmp'', FA_READ);
f_read(&fsrc, hdr, sizeof(hdr), &bytesread); // Read header
off = *((uint32_t *)&hdr[0x0A]); // offset to rasters
xx = *((uint32_t *)&hdr[0x12]); // X pixels
yy = *((uint32_t *)&hdr[0x16]); // Y pixels
f_lseek(&fsrc, off); // Seek to the data
for(y=0; y<
yy
; y++)
{
for(
x
=
0
; x<xx; x++)
{
uint32_t rgb;
f_read(&fsrc, &rgb, 3, &bytesread); // Read pixel B G R
// RRRRRRRRGGGGGGGGBBBBBBBB 8:8:8
// RRRRRGGGGGGBBBBB 5:6:5
rgb = ((rgb & 0xF80000) >> 8) | ((rgb & 0x00FC00) >> 5) | ((rgb & 0x0000F8) >> 3);
LCD_SetPoint(y, x, rgb);
} // x
} // y
f_close(&fsrc);
}
2014-04-19 01:02 AM
Thanks for the reference, anyway who is that in the icon ?
and if I have 1024 x 768 picture, and I want to display on 320x240, can I manipulate it from software or I can not ? thank you2014-04-19 02:11 PM
anyway who is that in the icon ?
That would be Randall Duk Kim.and if I have 1024 x 768 picture, and I want to display on 320x240, can I manipulate it from software or I can not ?
Sure you could display a portion of it, and move it around, You could also shrink-to-fit using either simple or complex methods of decimation, or resampling/interpolating.2014-04-19 04:04 PM
You could also shrink-to-fit using either simple methods of decimation, or resampling/interpolating.
Do you mean by dividing 1024 x 768 into 320 x 240 ? decimation ? resampling ? 1024 / x = 320 ? I can display part of 1024x768 ? how can I move it ? change the loop ? It seemed slower than 320x240 picture, did it mean , it was reading the complete 1024x768 but can't display it ? Thanks2014-04-19 07:09 PM
I think we seem to be struggling with some pretty basic concepts here.
Yes, if you process the entire image it's going to be slower, because there's a large portion where you process the data, yet it's not going to be displayed. Each raster is of known length, you can constrain how many pixels are processed by shortening the loop, and then indexing the offset into the file to the next raster, or basically skipping those pixels you don't need to process. You can ''move'' the image by picking a starting point within the data and just displaying a 320x240 ''window'' of the larger image. You could reduce the image by processing every other pixel, and every other line. You could perhaps improve that by looking at the surrounding pixels and average the colour. You need too: Learn the ''structure'' of the data you want to process, and the representation of graphic data in rastered formats. Learn the techniques related to image processing. Learn how to program, and apply data processing techniques.2014-04-19 07:38 PM
Ok, thank you very much for your suggestions, it seems complicated for doing image processing....
2014-04-20 04:38 PM
For the first time I can start from :
http://www.scratchapixel.com/lessons/3d-advanced-lessons/interpolation/bilinear-interpolation/
How do you reckon ? thanks2014-04-20 06:10 PM
How do you reckon?
An understanding of these, and related topics, would help you significantly.2014-04-20 06:54 PM
Thank you very much for the inspiration,
I saw this as well, http://en.wikipedia.org/wiki/Bilinear_interpolation#Application_in_image_processing