English 中文(简体)
将位图从ARGB1555转换为RGB8888
原标题:Converting bitmap from ARGB1555 to RGB8888

我现在有点脑放屁,但我需要帮助将图像从ARGB1555转换为RGB8888。

我已经有了遍历每个像素的循环(基本上是从文件中读取u16s),我想将它们存储为u32。我想我只需要使用一些二进制运算符来获得2-6、7-11和12-16位,然后使用另一个运算符以某种方式将每种颜色更改为它们各自的RGB8888值。。。但我真的不知道该怎么做。

最佳回答

You didnt state what language you are writing it in but here is a C++ function for it: It takes the 16 bit integer in ARGB1555 and returns a 32 bit integer in ARGB8888

unsigned int ARGB1555toARGB8888(unsigned short c)
{
    const unsigned int a = c&0x8000, r = c&0x7C00, g = c&0x03E0, b = c&0x1F;
    const unsigned int rgb = (r << 9) | (g << 6) | (b << 3);
    return (a*0x1FE00) | rgb | ((rgb >> 5) & 0x070707);
}

参考:http://cboard.cprogramming.com/c-programming/118698-color-conversion.html

问题回答

暂无回答




相关问题
Resources for Image Recognition

I am looking for a recommendation for an introduction to image processing algorithms (face and shape recognition, etc.) and wondered if anyone had an good recommendations, either for books, ...

Good reference book for digital image processing? [closed]

I am learning digital image processing on my own and would like recomendations on good reference books. If you know of books to definately stay away from that would be useful as well. Thanks

Python Tesseract can t recognize this font

I have this image: I want to read it to a string using python, which I didn t think would be that hard. I came upon tesseract, and then a wrapper for python scripts using tesseract. So I started ...

What s the quickest way to parallelize code?

I have an image processing routine that I believe could be made very parallel very quickly. Each pixel needs to have roughly 2k operations done on it in a way that doesn t depend on the operations ...

Computing object statistics from the second central moments

I m currently working on writing a version of the MATLAB RegionProps function for GNU Octave. I have most of it implemented, but I m still struggling with the implementation of a few parts. I had ...

Viola-Jones face detection claims 180k features

I ve been implementing an adaptation of Viola-Jones face detection algorithm. The technique relies upon placing a subframe of 24x24 pixels within an image, and subsequently placing rectangular ...

热门标签