I import the following image which is a [583x673x3] uint8 :
and i would like the convert the grey/black color to origianally black.How it can be ?

 Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 6 Nov. 2014

0 Stimmen

Igray = rgb2gray(I);
BW = im2bw(Igray,graythresh(Igray));
imshow(BW)

2 Kommentare

grayImage = uint8(255 * BW);
Dimitrios
Dimitrios am 6 Nov. 2014
Sorry i deleted the question,because i found it.but thanks for the answer.For others my question was 'How to convert the resulted image again to uint8?'

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Youssef  Khmou
Youssef Khmou am 6 Nov. 2014
Bearbeitet: Youssef Khmou am 6 Nov. 2014

0 Stimmen

rgb2gray(im2double(X));

1 Kommentar

Dimitrios
Dimitrios am 6 Nov. 2014
thank you for your answer, but the image remained the same.

Melden Sie sich an, um zu kommentieren.

Chad Greene
Chad Greene am 6 Nov. 2014

0 Stimmen

Tinker with this threshold value:
threshold = 250;
A = imread('export_fig_out.png');
A(A>=threshold)=255;
A(A<threshold)=0;
imshow(A)

2 Kommentare

Chad Greene
Chad Greene am 6 Nov. 2014
Before adjusting the image, (if you have the image processing toolbox) try imhist(A) to see where values in A lie relative to the gray scale.
Sean de Wolski
Sean de Wolski am 6 Nov. 2014
graythresh separates modes for you :)

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by