I'm writing an algorithm to define the images which whole or most of it, is black.
I checked some images and find out that the values for these kind of images in RGB format are mostly from 30 to 40.
Is my idea right?
and if it's, how can i check if most of the values in a matrix(which in this case the matric is my image) is between 30 to 40 or not?
I used mean but the result is still in array,then i used norm but there is this error:
Undefined function 'norm' for input arguments of type 'uint8'
0
votes
2 Answers
1
votes
1
votes
If you want to see which values occur in your image, here is what you can do:
Suppose you have a image M:
M = uint8(magic(5));
Here is how you can get the rough distribution:
hist(double(M(:)))
You can use this on the entire image at once, or do it per channel as shown below:
M = uint8(round(255*randn(5,5,3)))
hist(double(M(:))) % Will give the results for all color channels at once
hist(double(M(:,:,1))) % Will give the results for only the first (red?) color channel
Using hist should give you the general idea of the distribution, but if you want to know the exact value that occurs most. Replace hist everywhere by mode.
double(myImage)- Dennis Jaheruddin