彩色图像以灰度级显示 [英] Colored image coming as Gray scaled

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

问题描述

这应该打开提供的原始彩色图像,但是我只能看到灰度图像.我在哪里弄错了?

This should open an original colored image as provided but I can see only the grayscale image. Where did I made a mistake?

private void btnODImg_Click(object sender, EventArgs e)
{
           int i, j;
           Graphics g = picDecrypt.CreateGraphics();
           Color c;
           Pen p;
           for (i = 0; i < IMGR; i++)
           {
               for (j = 0; j < IMGC; j++)
               {
                   if (imgIDCT[i, j] < 0)
                       imgIDCT[i, j] = Math.Abs(imgIDCT[i,j]);
                   if (imgIDCT[i, j] > 255)
                       imgIDCT[i, j] = 255;
                   c = Color.FromArgb(imgIDCT[i, j], imgIDCT[i, j], imgIDCT[i, j]);
                   p = new Pen(c);
                   g.DrawLine(p, i, j, i + 1, j);
               }
           }
}

推荐答案

DCT-那是离散余弦变换吗?

不确定代码要做什么,但错误非常明显,Color.FromArgb对红色,绿色和蓝色成分采用相同的参数,因此会给您不同的灰色阴影.
DCT - is that discrete cosine transform?

Not sure what the code is trying to do, but the error is quite obvious, the Color.FromArgb takes the same parameter for the red, green and blue constituents and hence will give you varying shades of grey.


这篇关于彩色图像以灰度级显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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