在2010年vb中询问如何将彩色照片转换为黑白照片 [英] Asked how to convert a color photo to black and white in vb 2010

查看:88
本文介绍了在2010年vb中询问如何将彩色照片转换为黑白照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我,因为我希望我的col.protect非常感谢你,我希望与你沟通再次非常感谢你,我希望能快速回答我的要求

please help me for that because i want that for my col.protect I thank you very and I wish to communicate with you thank you very much once again and I hope to answer quickly to my request

推荐答案

首先需要加载图像,然后访问每个像素,将其更改为黑色或白色RGB值,具体取决于其当前颜色。

An有关如何执行像素访问(包括修改)的示例位于 LockBits [ ^ ] LockBits 方法文档。



天真 col_to_bw 方法可以是:

You need first to load the image and then, accessing every single pixel, change it to either black or white RGB values, depending on its current color.
An example on how to perform pixel access (modification included) is in the LockBits[^] LockBits method documentation.

A naive col_to_bw method could be:
void col_to_bw( ref byte r, ref byte g, ref byte b )
{
  if ( r*r + g*g + b*b >= 48387) // 48387 = 127*127*3
  {
    r = g = b = 255;
  }
  else
  {
    r = g = b = 0;
  }
} 





当然你可以做得更好。



of course you could do better.


访问链接

见主题5:灰度

使用C#进行图像处理 [ ^ ]



快乐编码!

:)
visit link
See Topic No 5: Grayscale
Image Processing using C#[^]

Happy Coding!
:)


这篇关于在2010年vb中询问如何将彩色照片转换为黑白照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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