开发者

How do I convert a 24-bit colour image to binary image using MFC?

开发者 https://www.devze.com 2023-01-04 16:07 出处:网络
how to con开发者_JAVA技巧vert a bitmap image in binary image?The simplest and easiest way to convert a grey scale image to a binary image is to just apply a threshold, i.e.

how to con开发者_JAVA技巧vert a bitmap image in binary image?


The simplest and easiest way to convert a grey scale image to a binary image is to just apply a threshold, i.e.

out[y][x] = in[y][x] > threshold ? 1 : 0;

The threshold value can be fixed, e.g. 128, variable, supplied by the user, or determined automatically by histogramming the image first.

There are more sophisticated methods which will generate subjectively "better" binary images, but without knowing more about your requirements it's hard to know whether you need something more advanced or whether simple thresholding will be good enough.

0

精彩评论

暂无评论...
验证码 换一张
取 消