フィルターのクリア

Black and white image

10 ビュー (過去 30 日間)
Rehan
Rehan 2015 年 4 月 29 日
編集済み: DGM 2022 年 10 月 14 日
Hello every one, i want to ask two similar things
1.If image is pure black and white matlab should tell me that image is pure black & white and if grayscale it should tell that its grayscale.
2.in my grayscale image if some pure black or white part come it should save it an array and other gray scale values should be saved in another array. i am attaching a black& white image for reference. Thanks

採用された回答

Image Analyst
Image Analyst 2015 年 4 月 29 日
Try this
[counts, grayLevels] = imhist(grayImage, 256);
if sum(counts(2:end-1)) > 0
% It's not pure black and white
end
% Get map of non-0 and non-255 pixels
grayPixels = grayImage > 0 & grayImage < 255;
% Get pure black and white image
bw = grayImage; % Initialize
bw(grayPixels) = 0; % Zero out any gray pixels.
% Get gray pixels only
grayOnly = grayImage; % Initialize
grayOnly(~grayPixels) = 0; % Zero out any pure 0 or pure 255 pixels.
  2 件のコメント
tarunika b
tarunika b 2021 年 4 月 1 日
how to add gray level image to speckle patterns ?
Image Analyst
Image Analyst 2021 年 4 月 1 日
@tarunika b, try this to add images
outputImage = grayImage + yourSpeckleImage;
or else use the imnoise() function.

サインインしてコメントする。

その他の回答 (1 件)

Kenneth Sampson
Kenneth Sampson 2016 年 8 月 11 日
編集済み: DGM 2022 年 10 月 14 日
It's my first time to know that Matlab can convert to black and white, I don't know b w photos can be made outside of photo software, thanks for shares.
  1 件のコメント
Image Analyst
Image Analyst 2016 年 8 月 11 日
I always avoid the phrase "black and white" because it's imprecise. I use the more precise terms "gray scale" or "binary" instead.
Sometimes people mean "black and white" to mean an image with only black and white, like a binary image, which is actually of class "logical". It has only black and/or white - there are no grays in between.
Sometimes people say "black and white" to mean like "black and white" televisions where the image is actually gray scale - it has black, white, and everything in between.
So for these reasons, I use only gray scale or binary and avoid the ambiguous term "black and white".

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by