hello I have a code that turns my image of black and white in color but I am stuck at the level of color segment I want the red part to be black
(attached image)
function [ ] = imageLabels(image)
figure,imagesc(image)
colormap(hsv)
axis image;
hold on;
for K = 1 : 4; hidden_h(K) = surf(uint8(K-[1 1;1 1]), 'edgecolor', 'none'); end
hold off
uistack(hidden_h, 'bottom');
legend(hidden_h, {'tree','rock','water'} )
axis off;
end

댓글 수: 9

Jan
Jan 2019년 1월 22일
What is "black an blan"? What is a "level of color segment"? You want "the red part to be black". I do not see any command in the attached code, which cares about anything on red. So what is "the red part"?
dakhli mohamed
dakhli mohamed 2019년 1월 22일
my starting image is black and white after code execution i want the white part to turn green and the black part to remain black instead of to be colored on red
Jan
Jan 2019년 1월 22일
What does "black and white" exactly mean: Is it a LOGICAL array, or a double array containing 0 and 1 only. Or does "black and white" mean gray scale? Or is it a 3D RGB array, which contains [0,0,0] and [1,1,1] only? Or an indexed image?
It would be much easier to work with RGB arrays instead of using a HSV colormap.
This means: I do not understand the question yet. Converting a grey scale image to an RGB image with white getting green is very easy. But to post working code, the type of the inputs must be clear.
dakhli mohamed
dakhli mohamed 2019년 1월 22일
it's a satellite image( attached) it's black and white I want the part on white is green, it's simply
Jan
Jan 2019년 1월 23일
I cannot open your MAT file, because I do not access to Matlab currently. It would be really simple, if you post the class, the size and the range of the array.
dakhli mohamed
dakhli mohamed 2019년 1월 23일
2 class
190 * 190 table size
the values between 0 and 1
Jan
Jan 2019년 1월 24일
편집: Jan 2019년 1월 24일
You can get the class of a variable by using
class(v)
This will be singlem double, uint8 etc.
The term "table" might be confusing: Is this a table object?
Stephen23
Stephen23 2019년 1월 24일
편집: Stephen23 2019년 1월 24일
190x190 double, inappropriately named ans, and with values ranging from 0 to 1.
Guillaume
Guillaume 2019년 1월 24일
Judging by the files and variable names, I would think the question is related to 441221-fusion-of-satellite-images

댓글을 달려면 로그인하십시오.

 채택된 답변

Guillaume
Guillaume 2019년 1월 24일

0 개 추천

Possibly, this will do what you want:
matcontent = load('C1fig.mat'); %load ans variable (bad name!) as matcontent.ans
greyimage = matcontent.ans; %the grey image as a 2D matrix in the range 0-1
greenimage = cat(3, zeros(size(greyimage)), greyimage, zeros(size(greyimage))); %make the greyimage the 2nd channel of a RGB image
imshow(greenimage);

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Blue에 대해 자세히 알아보기

질문:

2019년 1월 22일

댓글:

2019년 1월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by