can u hhelp me by giving the syntax for making an intensity matrix from the given image...

6 views (last 30 days)
Image=imread('D:\semester 3\matlab work\images\hand.jpeg');
imshow(image);
disp(image);
after executing it the command window shows its intensity values....i want to make the matrix from these intensity values... how can i do it????can u help me for the same???
i want to use these intensity values in my code...dats y......

Accepted Answer

Walter Roberson
Walter Roberson on 8 Feb 2013
You read the intensity values into an array named "Image" with a capital-I. And after that you used "image" with a lower-case-I. image with a lower-case-I happens to be the name of the MATLAB routine to create a graphics image. It happens to be valid to call image() with no parameters, in which case it displays a default image and returns the handle-graphics handle of the image object.
You then apply imshow() to the handle of the image object; imshow is probably going to automatically erase your current figure contents, causing the default image object to be deleted, and then creating a new image object that displays based upon the chance numeric value the handle had.
You then disp(image) which is going to create a new default image object and output the handle graphics handle of the image object.
What you need to do is go back and use consistent variable names in your code, preferably avoiding using "image" or "Image" as the variable name.
  6 Comments
Walter Roberson
Walter Roberson on 8 Feb 2013
It is possible that the image is RGB. In that case,
IntensityImage = im2double( rgb2gray( originalImage ) );
Here I am using "intensity matrix" to mean that values must be in the range 0 to 1. There are a lot of calculations that can be done using integer intensity matrices, but I converted to [0, 1] because that was the range needed yesterday by someone else who needed to know how to convert to intensity matrix.
Image Analyst
Image Analyst on 8 Feb 2013
Edited: Image Analyst on 8 Feb 2013
Depends on the definition of intensity. rgb2gray converts a color image into a gray scale image with weights of the three channels (R, G, and B) represented by the human luminous efficacy function. And before conversion each color channel has it's own "intensity". There are many laymans uses of the word intensity, but the rarest is probably the actual SI radiometric definition of intensity, which has units of watts per steradian or lumens per steradian depending on whether you're talking about radiometric (all wavelengths) intensity or luminous (visible wavelengths only) intensity. This is quite unlike the most common layman's definitions which would have units of either lux (commonly used for light incident on a surface) or candela per square meter (also called nit), which is used for surfaces that emit light, like a computer monitor. A optics professor of mine (Jim Palmer) wrote an article (1993 Metrologia journal, vol 30, p. 371-372) called "Getting intense on intensity" Here is a snippet from that article:
"But wait a second! While studying the AIP Style Manual [3] during preparation of a chapter for the Handbook of Optics (2nd edition), I was forcefully reminded of the following: intensity is an SI base quantity albeit with the modifier luminous. The name of the corresponding SI base unit is the candela and the symbol is cd. One candela is one lumen (lightwatt) per steradian. Therefore the dimensionality of intensity is (photometric or radiometric flux) per steradian. Intensity thus takes its place alongside the other six SI base quantities: length (metre), mass (kilogram), time (second), electric current (ampere), thermodynamic temperature (kelvin) and amount of substance (mole)."
You could make the argument that a gray level has units of energy - joules. Since it is the incoming power density of the light (watts per square meter) integrated over a pixel area (meters square) and exposure time (seconds), which works out to joules (or lumens if you're restricting to the visible wavelengths and weighting by the spectral power by the human visual efficacy).

Sign in to comment.

More Answers (1)

vivek govind
vivek govind on 23 Mar 2013
Edited: vivek govind on 23 Mar 2013
To obtain pixel intensity values from an image and store it in an array , you can use this code, suppose i have a 75x75 image ,
gg=imread('D:\semester 3\matlab work\images\hand.jpeg');
for i=1:74,
for j=1:74,
P(i,j) = gg(i,j+1);
end
end

Community Treasure Hunt

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

Start Hunting!