改变图像的颜色 [英] Changing Colors of an Image

查看:65
本文介绍了改变图像的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好!我几乎在任何地方都进行了各种搜索,最后我在这里问了。



我只有一个问题。





假设我有一个包含头发(卷发)图像的图片框,白色背景和3个按钮(红色,绿色和蓝色)。如果我按下红色按钮,图片框内的头发将变为红色(不包括白色BG)。



我如何创建它的代码?我可以举个例子吗? TY提前:D

Okay! I almost done all the kinds of searching anywhere and I ended up asking it here.

I only have just one 1 question.


Let just say I have a picturebox that contains an image of a Hair(Curly Hair) with a white background and 3 Buttons (Red,Green and Blue). If I press the Red Button the Hair inside the picturebox will change to red (Do not include the white BG).

How can i create a code of it? Can i have an Example? TY in advance :D

推荐答案

在这里搜索文章图像处理傻瓜,你会得到拉动这个小项目所需的基本工具关闭。
Search the articles here for "Image processing for dummies" and you'll come up with the basic tools you need to pull this little project off.


这听起来像是作业。但是为什么不对它有所帮助。



RGB是一个颜色空间(没有明确定义,期望你参考sRGB,不幸的是sRGB同时也不再定义一种独特的方式)。现在你可以忘记最后一个括号中的注释。



R = G = B = 0表示黑色。

R = G = B = 255表示白色。



如果你真的处于幸运位置,你的背景正好是RGB-white,你只需要设置R的每个点< 255 && G< 255 && G< 255到用户选择的颜色。这当然假设您知道如何访问图片的每个像素。



但请注意,白色背景可能不是那么完美。然后最好用可选择的限制替换上面提到的255.



顺便说一下,白色卷发的每个像素都保持白色在这个简单的解决方案中。
It sounds like this is homework. But why not help also a little bit on this.

RGB is a color space (not well defined expect you refer sRGB and unfortunately also sRGB meanwhile is not longer defined in a unique way). For now you can forget the remark in the last bracket.

R= G= B= 0 means black.
R= G= B= 255 means white.

In case you are really in the lucky position that your background is exactly "RGB-white" you need only to set each point where R < 255 && G < 255 && G < 255 to the color the user choose. This assumes of course that you know how to access each pixel of the pic.

But please be aware that the white background is maybe not that perfect. Then it is better to replace the 255 mentioned above by a selectable limit.

And by the way, each pixel of the curly hairs which is white, remain "white" in this easy solution.


这篇关于改变图像的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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