I have a Matlab array of one dimension ie grayscale, but I would like to create an RGB equivalent in which all black of this, i.e. all zero is a green tone. And let all other white and gray colors be kept from the original matrix in the same color.
I have a Matlab array of one dimension ie grayscale, but I would like to create an RGB equivalent in which all black of this, i.e. all zero is a green tone. And let all other white and gray colors be kept from the original matrix in the same color.
As you did not inform the original matrix, I'll assume this:
% matriz original:
matrix_cinza = rand(64, 64);
And viewing:
% imagem original
% Sendo: cat(3, VERMELHO, VERDE, AZUL)
% Mas, como é escala de cinza os três canais são iguais.
imagem_cinza = cat(3, matrix_cinza, matrix_cinza, matrix_cinza);
Tohighlighttheblackelementsyoucancreateamatriz_destaca
andchangethevalueofthosethatareblackto1.Inthiscase,valueslessthan0.1wereconsideredblack,butyoucanchangethemtothedesiredlevelinmatrix_destaca<0.1
.
matrix_destaca=matrix_cinza;matrix_destaca(matrix_destaca<0.1)=1;
Soyoucangeneratethehighlightedimagejustthegreenimagelayer:
imagem_destacada=cat(3,matrix_cinza,matrix_destaca,matrix_cinza);image(imagem_destacada);
Whatresultsin: