grayscale image, adjust color intesity

2 ビュー (過去 30 日間)
Tomas
Tomas 2014 年 3 月 16 日
コメント済み: Tomas 2014 年 3 月 17 日
Hello,
I have image.
I1= imread('strom','bmp');
imshow(I1)
I2=rgb2gray(I1);
imshow(I2);
[m n]=size(I2)
P = [];
for i=1:m
for j=1:n
if I2(i,j)>=0 && I2(i,j)<=64
P = [P ; i j ];
end
end
end
size(P);
MON=P;
how i set all shades of gray in matrix.
Thanks.

回答 (1 件)

Image Analyst
Image Analyst 2014 年 3 月 16 日
Never use size() on images like you did. It's dangerous. See this: Steve's blog on this
Do this instead:
[rows, columns, numberOfColorChannels] = size(yourImage);
And I don't know what "set" means to you. Do you just want (for some reason) an N by 2 list of the (row, column) locations of all gray levels in a certain range? If so do this:
binaryImage = I2 >= 0 & I2 <= 64;
[rows, columns] = find(binaryImage);
  13 件のコメント
Image Analyst
Image Analyst 2014 年 3 月 17 日
I gave you an example for a color image, but then you said "I don't know,what to do,if I have grayscale image." so I gave you suggestions for grayscale images. But now you show a color image again. And you ask "I don't know show image." whatever that means. Why not just use imshow() to show an image? Why are you confusing me by keep switching color mode? I've given suggestions for both but whenever I do you ask about the other. Sorry, but I think maybe it's best if we let someone who has kmeans() to take over and help you now. They will be able to understand you better than me.
Tomas
Tomas 2014 年 3 月 17 日
Of course I'm the input image, convert to grayscale image. I don't know show image, because, i have main ouput in cell, i must convert to matrix and then show,only i have error, I don't know repair error. It is pity that you do not have statistical toolbox. Thanks for your time and valuable advice.

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

カテゴリ

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