Android 2.3 上的 getPixel
我开发了一个能够识别所选图像区域颜色的应用程序。 它完美适用于 Android 2.2。 现在我尝试在设备 2.3 上使用它。 为了使其在 2.2 上正常工作,我必须克服由抖动和屏幕位格式引起的许多问题。 现在我在 2.3 上遇到了同样的问题,我不知道该发明什么。
color = mBitmap.getPixel((int)event.getX(), (int)event.getY());
没有看到颜色差异很小。
I developed an application that is able to recognize the color of a selected image area.
It works perfectly for Android 2.2.
Now I'm trying to use it on devices 2.3.
To make it work properly on 2.2 I had to overcome many problems caused by dithering, and the format of the bits of the screen.
Now I have the same problem for 2.3 and I do not know what to invent.
color = mBitmap.getPixel((int)event.getX(), (int)event.getY());
Does not see color differences very small.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
讨论使我相信(例如“我看到一个值大于两个值”)您正在数学上将 ARGB 值与 RGBA 值或类似的值进行比较。了解您正在编码,特别是哪个字节包含“alpha”分量,并比较颜色分量,而不是 32 位值。
The discussion leads me to believe (e.g. "I see a single value greater than both") that you're mathematically comparing an ARGB value to an RGBA value, or something like that. Know you're encoding, particularly which byte holds the "alpha" component, and compare the color components, not the 32-bit value.
如果您在图像上使用移动平均滤波器来检查附近的像素,这可能有助于消除抖动。
what if you use a moving average filter on the image to check nearby pixels, this could help with the dither.