如何在Opencv中将图像转换为Octachrome? [英] How Can I Convert An Image To Octachrome In Opencv?

查看:103
本文介绍了如何在Opencv中将图像转换为Octachrome?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究手势识别,我偶然发现了这篇文章。 http:// www.cse.iitb.ac.in/~aamod/glive/itsp.html [ ^ ]



我无法理解这一特定的行,我不知道如何在opencv中实现这一点。这是一行 - 然后这个图像被转换为​​八度颜色(仅8种颜色 - 红色,蓝色,绿色,青色,品红色,黄色,白色,黑色)。这使得大多数像素为中性或灰色。我在opencv中查找了一个函数,以便我可以将我的图像转换为octa-chrome但我找不到任何这样的函数。任何人都可以建议我如何将图像转换为octa-chrome格式?

I was studying about hand gesture recognition and i stumbled upon this article.http://www.cse.iitb.ac.in/~aamod/glive/itsp.html[^]

I couldn't understand this particular line and i have no clue how to implement this in opencv. This is the line - " Then this image is converted to octachrome(8 colours only - red, blue, green, cyan, magenta, yellow, white, black). This makes most of the pixels neutral or grey". I looked in opencv for a function such that i can convert my image to octa-chrome but i couldn't find any such function. Can anyone please suggest me how i can possibly convert an image to octa-chrome format?

推荐答案

你必须编写一个转换函数,它具有旧颜色和返回新颜色。在图像的每个像素上运行此功能。



伪代码:



you must write a conversion function, which has as input the old color and returns the new color. Run this function on every pixel of the image.

pseudo code:

Picture pic1; //loaded
Picture pic2;//created with targeted colors und size

for( int x=0; x<ypic1.width();x++)> for( int y=0; xy<pic1.heigth();y++)>  Color clr1 = pic1.getColor(x,y);//from pic1
  Color clr2 = myConversion(clr1);//here you decide the new color
  pic2.setPixel(x,y,clr2);//in pic2
 }
}


这篇关于如何在Opencv中将图像转换为Octachrome?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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