static image<uchar> *imageRGBtoGRAY(image<rgb> *input)
{
int width = input->width();
int height = input->height();
image<uchar> *output = new image<uchar>(width, height, false); for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
imRef(output, x, y) = (uchar)((( rgb *)imPtr(output, x, y))->r* RED_WEIGHT + (( rgb *)imPtr(output, x, y))->g * GREEN_WEIGHT +(( rgb *)imPtr(output, x, y))->b * BLUE_WEIGHT);
}
}
return output;
}
{
int width = input->width();
int height = input->height();
image<uchar> *output = new image<uchar>(width, height, false); for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
imRef(output, x, y) = (uchar)((( rgb *)imPtr(output, x, y))->r* RED_WEIGHT + (( rgb *)imPtr(output, x, y))->g * GREEN_WEIGHT +(( rgb *)imPtr(output, x, y))->b * BLUE_WEIGHT);
}
}
return output;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货