grayscale image, adjust color intesity
2 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Image Analyst
on 16 Mar 2014
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 Comments
Image Analyst
on 17 Mar 2014
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.
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!