Prev: Matlab Figure won't appear docked inside Plot Tools window
Next: CAT arguments dimensions are not consistent
From: Brandon Giles on 23 Jun 2010 17:36 Hi everyone, I'm fairly new at image manipulation in Matlab, and I've run into a problem that is confusing me. I'm trying to display an image represented by a 512x512 matrix with elements of class double. Most of the values in the matrix range from .28 -.40. I have called the matrix "pic". I want to represent this as a black and white image, so I enter the commands imagesc(pic) colormap('gray') and my image shows up in the figure just as I would expect. However, I want some of the functionality from imtool. I type imtool(pic) and I get a completely black image, with pixel values that range from [0, 5e-10). I can view the image if I use the command imtool(pic,[]), but then I can't adjust the contrast. Is there a way to permanently rescale my original data so that when imtool is called it produces an image with pixel values between 0-1 instead of 0-5e-10? (This way I could view my picture without having to have it autoscale or whatever the [] does). Any explanation of what is going on or suggestions would be greatly appreciated! Thanks so much Brandon
From: Wayne King on 23 Jun 2010 18:16
"Brandon Giles" <bg95722(a)aim.com> wrote in message <hvtuo5$c70$1(a)fred.mathworks.com>... > Hi everyone, > I'm fairly new at image manipulation in Matlab, and I've run into a problem that is confusing me. > > I'm trying to display an image represented by a 512x512 matrix with elements of class double. Most of the values in the matrix range from .28 -.40. I have called the matrix "pic". I want to represent this as a black and white image, so I enter the commands > > imagesc(pic) > colormap('gray') > > and my image shows up in the figure just as I would expect. However, I want some of the functionality from imtool. I type > > imtool(pic) and I get a completely black image, with pixel values that range from [0, 5e-10). I can view the image if I use the command > > imtool(pic,[]), but then I can't adjust the contrast. > > Is there a way to permanently rescale my original data so that when imtool is called it produces an image with pixel values between 0-1 instead of 0-5e-10? (This way I could view my picture without having to have it autoscale or whatever the [] does). Any explanation of what is going on or suggestions would be greatly appreciated! Thanks so much > Brandon Hi Brandon, if your pixel values really lie in the interval [0.28, 0.4] Then what about just entering: imtool(ImageData,[0.28 0.4]); For example: X = 0.34+0.02*randn(512,512); imagesc(X); colormap gray; % compare with imtool(X,[0.28 0.4]); Hope that helps, Wayne |