Black pixel representation in the binary image

조회 수: 8 (최근 30일)
Kritsada
Kritsada 2012년 6월 23일
Why sometimes does black pixel in the binary image represent by value 1 sometimes value 0?

답변 (3개)

Walter Roberson
Walter Roberson 2012년 6월 23일
Sometimes the information is in the white pixels and sometimes the information is in the black pixels.
In a normal photograph we look for the brighter (more white) objects as being the primary information, but when we are looking at (for example) hand-writing, that is black writing on a lighter background and it is the black that holds the information.
In computer programming, it is usually mathematically easier to represent the color of interest with a 1 pixel.

Image Analyst
Image Analyst 2012년 6월 23일
In a binary image, a black pixel is never represented by a value of 1 (true), unless you have changed, for some strange and unnecessary reason, the colormap. Black pixels are always represented by 0 (false).
Perhaps you really meant to say "Why are black pixels in a grayscale image sometimes seen as black, and sometimes as white, in the binary image after the grayscale image has been thresholded?" In that case, if your dark pixels represent the objects of interest, you can threshold this way to have your dark objects show up as white (1, true) in your binary image:
darkObjects = grayImage < 50; % Or whatever threshold you want.
On the other hand if the light portions of your grayscale image were the objects of interest, then you could threshold this way to get the white objects to show up as white (1, true) in your binary image:
lightObjects = grayImage > 50;
In that case, dark objects show up as black (0, false) in your binary image - the opposite of the first example.

Kritsada
Kritsada 2012년 6월 23일
Thank you for you two answers. Sometimes, I resave the image by using Photoshop and the value of black color change from 0 to 1. ( white from 1-> 0) That may be because of gray scale of it.

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by