- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试从嵌入式相机 (datasheet here) 获取分辨率为 80 x 60 的 16 位彩色图像。我成功地从相机中获取了 9600 (80 * 60 * 16/8) 字节,但是我在显示图像时遇到了问题。我正在使用以下代码将字节数组转换为位图:
bm = Bitmap.createBitmap(80, 60, Bitmap.Config.RGB_565);
bm.copyPixelsFromBuffer(ByteBuffer.wrap(jpegBytes));
jpegBytes 是图像字节数组,长度为 9600 字节。
现在,我得到的图像看起来像这样:
99% 的时间。但是,我可以获得如下所示的未损坏图像:
很少。有没有人对为什么会这样有任何建议?非常感谢!
更新:
似乎所有像素都在正确的位置,但它们的 RGB 值混淆了。例如,两张照片之间的白色部分是相同的,因为 RGB 的顺序对于变白无关紧要。然而,很明显颜色混淆了,因为红色椅子在损坏图像中显示为蓝色,而蓝色背包在损坏图像中显示为绿色
最佳答案
使用Config.ARGB_8888
作为位图配置
来自 public static final Bitmap.Config RGB_565 的文档:
Each pixel is stored on 2 bytes and only the RGB channels are encoded: red is stored with 5 bits of precision (32 possible values), green is stored with 6 bits of precision (64 possible values) and blue is stored with 5 bits of precision. This configuration can produce slight visual artifacts depending on the configuration of the source. For instance, without dithering, the result might show a greenish tint. To get better results dithering should be applied. This configuration may be useful when using opaque bitmaps that do not require high color fidelity.
关于java - Android 16 位彩色图像到位图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17819425/
我需要获取 UInt16 和 UInt64 中的值作为 Byte[]。目前我正在使用 BitConverter.GetBytes,但这种方法每次都会给我一个新的数组实例。 我想使用一种允许我将这些值“
我一定是误解了 CSS 中的某些内容,因为我使用库 ( dat-gui ) 的下拉框正在这样做: 我已经尝试为 dat-gui 容器下面的 div 切换到 position: absolute,这会破
TOHtml 可用于将文件转换为 html,但它也会创建一个新文件。例如,如果原始文件名为 test,vim 将创建一个名为 test.html 的新文件。 有没有一种方法可以就地修改文件,即只将 t
你如何排序 IndexedSeq在斯卡拉的地方? API函数在哪里? 最佳答案 目前没有什么可以就地对它们进行排序。 如果您确实需要,可以转换 IndexedSeq到 Array[AnyRef]并使用
我正在尝试在字符串/对象类型的数据框中的 4 个特定列上用“”填充 NA。我可以在 fillna() 时将这些列分配给一个新变量,但是当我 fillna() inplace 时,基础数据不会改变。 a
我需要将我的测试结果放入一个 csv 文件中进行报告。在我的 python 测试代码中,当我没有值时,我的变量以 python 方式填充为 None。 有人要求我在报告工具的 CSV 文件中将这些替换
在我的网站上,我有一个元素位于上 Angular ,因此当他或她向下滚动时会跟随用户。就像this Fiddle .相反,我想做的是通过在用户滚动时保持不动然后加速回到其固定位置来使其具有更好的跟随效
有没有办法让 Webpack 将 #!/usr/bin/env Node 放在我的文件顶部? 我正在尝试将 CLI 与模块捆绑在一起...仅使用一个配置文件单独导出我的 index.js/cli.js
我想匹配 ArrayList 以便正确的 Burgare 获得正确的位置例如,Burgare6 获得位置 6,Burgare2 获得位置 2,依此类推。 public static void main
如何使用 boost::mpi 1.53 就地全部减少? (这是 CentOS 7 的版本) boost 1.61 有 boost::mpi::inplace_t ( doc ) 但 boost 1.
我有一些外国的 html 并且想用 css 表格来格式化它。不幸的是,html 在“tabular-row-divs”和“tabular-cell-divs”之间包含一个额外的 div。 例子:HTM
我有一张图片、一个标题、一段文字、一个日期和一个来源。我想将图像放在左侧,将来源和日期放在底部。如果文本太多,它们将位于图像下方,这很好。但如果太少。我希望日期和来源位于图像旁边的底部,如下所示:
我有这个程序: #include #include using namespace std; int main() { string inputfile = "input.pdf";
我是一名优秀的程序员,十分优秀!