How to get pixel intensity values of an image

  • Permalink
  • submit to reddit
  • Email
  • Follow


Hi all,

I'm a beginner in matlab.
I have a grayscale image and I would like to get the intensity value of every pixels in the image.
As far as I know, imhist will only show a graph of the intensity value. Instead, I want to retrieve the value (i.e the integer value).

Thanks in advance
1
Reply Hendy 1/4/2010 5:23:04 AM

See related articles to this posting


"Hendy Sutomo" <hendy.sow@gmail.com> wrote in message <hhrtvo$2g3$1@fred.mathworks.com>...
> Hi all,
> 
> I'm a beginner in matlab.
> I have a grayscale image and I would like to get the intensity value of every pixels in the image.
> As far as I know, imhist will only show a graph of the intensity value. Instead, I want to retrieve the value (i.e the integer value).
> 
> Thanks in advance

but - the values are already there: in your matrix...

us
0
Reply us 1/4/2010 7:54:04 AM

Which matrix u mean?
sorry, I'm a total noob here

Thanks for ur help
0
Reply Hendy 1/4/2010 8:07:03 AM

"Hendy Sutomo" <hendy.sow@gmail.com> wrote in message <hhs7j7$9if$1@fred.mathworks.com>...
> Which matrix u mean?
> sorry, I'm a total noob here
> 
> Thanks for ur help

well, look here...

http://www.mathworks.com/access/helpdesk/help/techdoc/learn_matlab/f3-1186.html

us
0
Reply us 1/4/2010 8:16:03 AM

Well.....

what i did is load an grayscale image, and use impixel to determine the value of pixels. But now i need the intensity value of each pixels.

I dont really get the information from the link u gave me.
Thanks for ur help


-hendy-
0
Reply Hendy 1/4/2010 8:26:03 AM

-hendy-
If you have an image, the image is in a numerical variable that is an
array.  The elements of that array ARE your intensity values.

For example:

% Read in standard MATLAB demo image.
grayImage = imread('cameraman.tif');
imshow(grayImage, []);
title('Original Grayscale Image');
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.

Let's say you want the intensity value at row 100, column 230.  Well
then you'd just say
intensityValue = grayImage(100, 230);

It's as simple as that.
0
Reply ImageAnalyst 1/4/2010 11:10:52 AM

Thanks alot ImageAnalyst.
Now I get the idea.

-hendy-
1
Reply Hendy 1/4/2010 12:56:03 PM

Hi,

Im also a new user of matlab
starting from this:

imshow(grayImage, []);

can you explain what i should put instead of []
is not really clear to me and i didn’t find something usefull in the net for understanding it

thank you very much
Luca

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <df97e1ed-d029-4a4b-ae46-0b32c140497d@f5g2000yqh.googlegroups.com>...
> -hendy-
> If you have an image, the image is in a numerical variable that is an
> array.  The elements of that array ARE your intensity values.
> 
> For example:
> 
> % Read in standard MATLAB demo image.
> grayImage = imread('cameraman.tif');
> imshow(grayImage, []);
> title('Original Grayscale Image');
> set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
> 
> Let's say you want the intensity value at row 100, column 230.  Well
> then you'd just say
> intensityValue = grayImage(100, 230);
> 
> It's as simple as that.
1
Reply paroni.luca (2) 12/22/2011 12:59:08 PM

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <df97e1ed-d029-4a4b-ae46-0b32c140497d@f5g2000yqh.googlegroups.com>...
> -hendy-
> If you have an image, the image is in a numerical variable that is an
> array.  The elements of that array ARE your intensity values.
> 
> For example:
> 
> % Read in standard MATLAB demo image.
> grayImage = imread('cameraman.tif');
> imshow(grayImage, []);
> title('Original Grayscale Image');
> set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
> 
> Let's say you want the intensity value at row 100, column 230.  Well
> then you'd just say
> intensityValue = grayImage(100, 230);
> 
> It's as simple as that.

Hi all, 
I want to retrieve the intensity value matrix of a ROI in a gray scale image into a given matrix, say "I[]". And to get the average intensity value of that particular ROI. How can I do this?
Thanks in advance
0
Reply youcanfindnuwan (1) 3/25/2013 6:31:05 AM
comp.soft-sys.matlab 203155 articles. 525 followers. Post

8 Replies
2640 Views

Similar Articles

[PageSpeed] 6


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

getting the values of pixels in images and drawing lines on images
please does any one know how to get the pixel values in images. i am using matlab 6.5 and it doesn't have the impixel function. is there an alternative. Also how do you draw lines on images, i am trying to track markers on an image and when i have tracked them to be a able to draw lines on the markers. thank you Tosin tosin wrote: > please does any one know how to get the pixel values in images. i am > using matlab 6.5 and it doesn't have the impixel function. is there an > alternative. > > Also how do you draw lines on images, i am trying to track markers on &g...

Get values from one image according to pixel locations of maxima on another image
Hello all I have two tiff images (named A and B). Both have 7 layers at the same dime= nsion (4169,6289,7). First I'd like to find location of max value in A imag= e and then I need to get the values (not max values, reall values) of B ima= ge in matrix dimension (4169, 6289) according to location of max value whic= h found from A image in previous step. I just wrote next code to achieve th= is purpose. Then I wrote output tiff image. But when I display this tiff im= age, whole screen is black. Can you tell me what's wrong with this code? A_max_loc=3DMAX(A,INDEX,DIMENSION=3D3...

Get min and max values from a multiband image according to pixel locations of classification image
Hello all,=09 I have a question to solve following issue.=20 I have two images. One is a multiband image with 7bands. Another is an clas= sifiction image with 3 classes. The classes named by class1 to class3. I'd = like to obtain a single max/min values from a multiband image according to = pixel locations of each classes (class1, class2, class3) of classification = image. Could you help me for this? Thank you very much Dry in water writes: > > Hello all, > > I have a question to solve following issue. > I have two images. One is a multiband image wi...

getting pixel from image as single value
hello all, i want to extract the value of each pixel from an image (color or greyscale)as single values.I wrote a function as follows.Here i am getting the green,blue,red components using methods of ColorModel and then taking the average(sum of r,g,b divided by 3).I don't know if this is the right way to do this.Can anyone tell me if there is an alternate/better method ? thanks jim public double[] getpixels(String imgfilename)throws Exception{ BufferedImage img =ImageIO.read(new File(imgfilename)); int ht=img.getHeight() ; int wd=img.getWidth(); int[] pixels = new int[wd * ht]; PixelGra...

How to get the pixel values of one line in an image?
Hi, group, I think it is easy to get the pixel values of a horizontal or vertical line in an image, such as: img = imread('test.bmp'); h_line = img( 10:10, 1:120); % for the horizontal line My question is how to get the pixel values of a line with a direction?( Neither horizontal nor vertical, i.e. 25 degree). The start and end positions of the line are given. Thanks. Vol Hi, help linspace <http://www.mathworks.com/access/helpdesk/help/techdoc/ref/linspace.html> help interp2 <http://www.mathworks.com/access/helpdesk/help/techdoc/ref/interp2.html> J�r�me J�r�me ...

getting pixel data from image as single value
hi i need to get value of each pixel in an image as a single value.The image may be color or greyscale .I tried as follows.I don't know if i am doing it right,and i want to know if it can be done in more compact manner.If anyone can advise/help pls do import java.awt.color.ColorSpace; import java.awt.image.*; import java.io.*; import javax.imageio.ImageIO; public class PixelDataDemo{ public static void main(String[] args){ PixelGrabber pg; BufferedImage img; try{ img=ImageIO.read(newFile("F:\\mygallery\ \myimage.png")); int ht=img.getHeight...

Pixel intensity mean value of image sequence
I have 10 images (frame-sequence). I want to make a new image A, whereas each pixel in A(x,y) is the mean-value of the pixel at (x,y) in the 10 original images. How to proceed? "Torvald Helmer" <torvald.helmer@mathworks.com> wrote in message <frb67e$qeq$1@fred.mathworks.com>... > I have 10 images (frame-sequence). I want to make a new > image A, whereas each pixel in A(x,y) is the mean-value of > the pixel at (x,y) in the 10 original images. > > How to proceed? A = (I1 + I2 + ... + I10) / 10; ...

How to Store Pixel Intensity Values in Image Sequence
Hi, all, For each pixel in each image of a sequence of 15 images, I need to store its RGB intensity values so that if I want, I can plot any pixel's R, G and/or B's intensity values across the sequence. I've been reading about structs and cells and vectors, but I am not sure what is best to use. Hope this makes sense. Much thanks. - Rise "Rise " <rise_riyo@hms.harvard.edu> wrote in message <hukvdl$ank$1@fred.mathworks.com>... > Hi, all, > > For each pixel in each image of a sequence of 15 images, I need to store its RGB intensity va...

pixel coordinates, intensity value, resize image matrix
Hi. how can I quickly change matrix A to matrix B? % A is image A = [21 38 64; 12 1 30; 11 4 9]; % imagesc(A), colormap gray % B is [n,3] coordinate matrix of color intensity B =[1 1 21; ... 1 2 38; ... 1 3 64; ... 2 1 12; ... 2 2 1; ... 2 3 30; ... 3 1 11; ... 3 2 4; ... 3 3 9]; Thanks V. cucche wrote: > Hi. > how can I quickly change matrix A to matrix B? > > % A is image > A = [21 38 64; 12 1 30; 11 4 9]; > % imagesc(A), colormap gray > > % B is [n,3] coordinate matrix of color intensity > B =[1 1 21; ... > 1 2 38; ......

Get pixel values from a binary image obtained using im2bw
Hi all, I am relatively new to the IP toolbox in MATLAB. I have a .TIFF image which I am converting to binary using the 'im2bw' function. Now I need to get the pixel values of this binary image in the form of a 2D array (exactly as they are, the images are 1320 * 1032) that I will use to do some operations in Java. Can someone point me in the right direction as to how can I do this? Thanx in advance. Mandeep Mandeep wrote: > > > Hi all, > > I am relatively new to the IP toolbox in MATLAB. > I have a .TIFF image which I am converting to binary using the > '...

find pixel values in one image and circle unwanted pixel values
Dear All, Can any one please Guide me on how to write a mat lab code to find an intensity values in one image, then exclude the values which I do not want and show them on the image .maybe i could circle the area which i do not want in the same image because of it's intensity values . Regards See my "BlobsDemo" image segmentation tutorial: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 It does all of that. Thanks ImageAnalyst , can you please suggest any other image than blobs to run your script. Jamal ImageAnalyst <imageanalyst@m...

3d image from pixel intensity of an image
How to create a 3d image from a set of 2d images? i have tried to use the following : I=imread('moon.tif'); [x,y]=size(I); X=1:x; Y=1:y; [xx,yy]=meshgrid(Y,X); i=im2double(I); figure;mesh(xx,yy,i); colorbar figure;imshow(i).. But when i replace the image by some other image it says: Warning: size(CData) must equal size(ZData) or size(ZData)-1 for flat shading ... Biman Chandra Dey Use cat(3,....) to put all your 2D images into a 3D volumetric image. All your 2D images must be exactly the same size. ...

Getting a image values out from a masked image
I have this image http://www.bjoernoest.dk/fish.jpeg, the one in the top (im) is my original, and the one in the bottom have an overlay of my mask (mask). How do i get a matrix or something else out, with the values of im that mask covers. It should be used to determine how large an area out of the total image mask covers + determine the intensity of the red compared to a std value. Bjørn On Feb 16, 6:45=A0pm, "Bjoern Oest Hansen" <booksforl...@dsr.kvl.dk> wrote: > I have this imagehttp://www.bjoernoest.dk/fish.jpeg, the one in the top (= im) is my original, and the ...

Assigning the intensity value to z value of an image
Dear all, Suppose that I have a cropped, grayscale human face image. How can I get the intensity value of each pixel, then assign it to the z value (depth) of the corresponding pixel? eg: image = imread('face.jpg'); for m : 300 for n : 400 % supposed that the image is 300 * 400 image(m,n) = ?? < - how should I write the code here? Hi, first, don't use "image" as a variable name. It's already the name of a built-in function. im=imread('face.jpg'); Then could you give more informations about your problem ? What do you expect ? J�r�me Dear Jerom...

No Pixel Spacing and only one Imager Pixel Spacing value
I am trying to display some MG images that do not have a Pixel Spacing attribute (0028,0030) and only one value (not a pair) in the Image Pixel Spacing attribute (0018,1164). What do I use to correct for radiographic magnification? Hi Cyndy On 9/23/11 5:14 PM, Cyndy Koobs wrote: > I am trying to display some MG images that do not have a Pixel Spacing > attribute (0028,0030) and only one value (not a pair) in the Image > Pixel Spacing attribute (0018,1164). What do I use to correct for > radiographic magnification? Obviously a single value in Imager Pixel Spacin...

X11: Get red, green and blue values from a pixel value
Hello, after retrieving a pixel from a window with XGetImage and XGetPixel (I know of the bad performance, of getting single pixels), I need to get the red, green and blue values of that pixel. In other words: I want to define the function: void drwPixelToRgb (long int pixel, unsigned int *red_val, unsigned int *green_val, unsigned int *blue_val); which should take the pixel and fill *red_val, *green_val and *blue_val. I have a solution when a TrueColor system is used. I determine the color system with: mydisplay = XOpenDisplay(""); myscreen = DefaultScreen(mydisplay...

How to extract pixel values of a colored image into an array and then to convert the array into an image
Hi all I am pretty new in Matlab. Plz help me with the following issues 1. say i have the image lena_color.gif 2. i want to convert it into an array of pixels(16 bits) so that i can convert it into binary 1's and 0's fo further manipulation. A two dimension array wud be preferred as in C wherein first dimension contains each element of the array and second dimension specifies the length which in this case is 16 bits. 3. After doing some manipulation bit wise,i want to see how the image has turned up. Is this possible? Any kind of suggestion will be appreciate gavishna shah w...

Get pixel value
Hi, I have a 500x500 matrix of data (D) that I plot with defined x (X) and y (Y) vlaues (i.e. contourf(X,Y,D)). However I want to extract certain pixel values from D knowing X and Y, so how do you assign the matrix (D) the X and Y components to get corresponding pixel. For example: Given X = 10:1:510, Y = 145:1:645 If I want to get pixel with X,Y coordinates 22,187? Thanks for any help? Evan wrote: > > > Hi, > > I have a 500x500 matrix of data (D) that I plot with defined x (X) > and y (Y) vlaues (i.e. contourf(X,Y,D)). > > However I want to extract certain pixel...

How to get pixel value?
Hello, How can i get the pixel value of an image, if i have: the x-pos, the y-pos, handle to the image, and the xdata/ydata were changed. Thanks, Asaf. Asaf wrote: > > > Hello, > > How can i get the pixel value of an image, if i have: > the x-pos, the y-pos, handle to the image, and the xdata/ydata were > changed. > > Thanks, > Asaf. help getpixelposition Yair Altman Asaf wrote: > > > Hello, > > How can i get the pixel value of an image, if i have: > the x-pos, the y-pos, handle to the image, and the xdata/ydata were > changed. > >...

Getting intensity value
Dear all, Supposed that I have a grayscale image and now I want to get the intensity value of each pixels, and set them as the z axis of the image, then extrude the image. How can i do that in matlab? I'm doing face extrusion and i wonder this could be done or not. cloudet wrote: > > > Dear all, > Supposed that I have a grayscale image and now I want to get the > intensity value of each pixels, and set them as the z axis of the > image, then extrude the image. How can i do that in matlab? > I'm doing face extrusion and i wonder this could be done or not. > >...

finding the four corners pixel location values of a small reectangular image in a large image
hi , can anybody help me in finding the edges(4 corners) of a small rectangular image in a large image. i have to find the both the index value of the four corners and their corresponding x and y pixel location. the small imagew is look like arectangle but it is not an exact rectangle. please help me to find the corners. On Mon, 18 Jan 2010 23:12:03 -0500, Usman Zafar <usman_zafar_iiui@hotmail.com> wrote: > hi , > can anybody help me in finding the edges(4 corners) of a small > rectangular image in a large image. > i have to find the both the index value of t...

image
hai , I need to know how to find the neighbouring pixel value for any image using matlab. samitha wrote: > > > hai , > > I need to know how to find the neighbouring pixel value > for any image using matlab. samitha wrote: > > > hai , > > I need to know how to find the neighbouring pixel value > for any image using matlab. if u know the index of the pixel u can access the nearby pixels by row-1 col-1 say u have pixel at im(10,10) Images are 2 D arrays. u can access the elements of the array im(9,10) im(9,9) im(10,9) im(10,11) etc... if u know the...

Grey Value at image pixels
Hi, Can anyone please guide me out of the following problem ? Let me put the problem in steps: I have an image : I (M by N) I want to know grey level value at certain pixels on that image; say I'm interested in 'n' number of pixels having co-ordinates (x1,y1),(x2,y2)......(xn,yn). Actually in stead of picking the exact grey value from a particular pixel, I want to create a (9 by 9) matrix keeping the pixel of interest at the centre of the matrix and then I want to extract the average grey value of those pixels. Can I do these (i.e. read in the image, specify the co...

Reading pixel values in an image
Hello all, I have a fairly trivial question, applied to a more specific problem. I am trying to sort through a multitude of satellite images. Some of these images weren't well read by the sensor and have blacked out pixels. The images with too many blacked out pixels will be discarded. Basically, I want to read all the pixels of a 75x75 matrix and know how many pixels are blacked out. Thanks for the help, Bruno Bruno wrote: > > > Hello all, > > I have a fairly trivial question, applied to a more specific > problem. > > I am trying to sort through a multitude of...