如何在位图中按颜色选择区域? [英] How do I select a region by color in a Bitmap?

查看:111
本文介绍了如何在位图中按颜色选择区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请提出一种在位图中按颜色选择区域的有效方法.然后,将此选定的区域颜色替换为所需的颜色.

Please suggest an efficient way to select a region by color in a bitmap. Then replace this selected region-color to your desired color.

例如,如果图像包含四种颜色,则说红色,绿色,黄色,橙色.现在假设用户单击了黄色,因此选择单击位置周围的黄色区域,然后将黄色替换为蓝色.

For example, If an image contains four colors say red, green, yellow, orange. Now suppose user clicked on yellow color, so select yellow colored region surrounding to the clicked position and now replace the yellow color to blue.

希望,我正确地解释了这个问题.如果需要更多说明,请发表评论.

Hope, I explained the question properly. Kindly comment if need any more clarification.

据我所知,位图是一项消耗内存的任务,并导致内存不足错误.

As per my knowledge, bitmap is a memory consuming task and results into out of memory error.

请共享任何链接或示例代码,这些链接或示例代码将帮助我将其实现到我的应用.

Please share any link or sample code that will help me to implement this feature to my app.

推荐答案

使用Palette API怎么样?

What about using Palette API?

  • Look the article [Extracting Colors to a Palette with Android]Lollipop(https://www.bignerdranch.com/blog/extracting-colors-to-a-palette-with-android-lollipop/)
  • Also read the official documentation about this tool

这篇关于如何在位图中按颜色选择区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆