什么是灰度图像最快的算法? [英] What's the most quickly algorithm to gray an image?
本文介绍了什么是灰度图像最快的算法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨每个身体
i想写一个图像处理项目我需要快速算法,但我使用的代码很低。我的代码是:
CImage i;
unsigned char gray [ 1000 ] [ 1000 ];
i.Load(_T( 1.jpg));
for ( int x = 0 ; x< i.GetWidth(); x ++){
for ( int y = 0 ; y< i.GetHeight(); y ++){
COLORREF color = i.GetPixel(x,y);
int ave =(GetRValue(color)+ GetGValue(color)+ GetBValue(color))/ 3;
grey [x] [y] = ave;
}
}
大家可以帮帮我吗?
提前谢谢
解决方案
看这里 - 它有一个缓慢而快速的方法...
使用ATL :: CImage将颜色转换为灰度 [ ^ ]
这里也有更多的理论解释不同的方法 - 在我看来,avarage
方法应该表现得最好...
http://www.johndcook.com/blog/2009/08/24/algorithms-convert-color-grayscale/ [ ^ 一>
in the name of god
hi every body
i want to write an image processing project that i need quickly algorithm, but the code that i used is low. my code is :
CImage i;
unsigned char gray[1000][1000];
i.Load(_T("1.jpg"));
for(int x=0;x<i.GetWidth();x++){
for(int y=0;y<i.GetHeight();y++){
COLORREF color=i.GetPixel(x,y);
int ave=(GetRValue(color)+GetGValue(color)+GetBValue(color))/3;
gray[x][y]=ave;
}
}
can everyone help me?
thanks in advance
解决方案
Look here - it has a slow and fast method...
Converting Color to Grayscale Using ATL::CImage[^]
Here also has a more theoretic explanation of different approaches - it seems to me thatavarage
method should perform best...
http://www.johndcook.com/blog/2009/08/24/algorithms-convert-color-grayscale/[^]
这篇关于什么是灰度图像最快的算法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文