Thread Subject: imwrite-saving a modified image

Subject: imwrite-saving a modified image

From: ben

Date: 10 Dec, 2007 15:25:51

Message: 1 of 5

Hi, i am trying to modify an image based on the histogram
of the pixel grayscale values in the unmodified image. i
can do the modification itself using imshow(image, [low
high]), however i cannot save this information as a new
seperate image/variable...any thoughts? sorry if this is
basic but i am a beginner....
-Ben

Subject: imwrite-saving a modified image

From: Jason Brown

Date: 10 Dec, 2007 15:42:30

Message: 2 of 5

Ben,

When I do this type of routine I use the find function in
matlab and search for areas below and above the "low" and
'high" values I'm interested in. Then you can set the
selected range to be black.

ex:

selected = find(image<low);
image(selected)=0;

-Jason

"ben " <badler10@yahoo.com> wrote in message
<fjjlpv$ed7$1@fred.mathworks.com>...
> Hi, i am trying to modify an image based on the histogram
> of the pixel grayscale values in the unmodified image. i
> can do the modification itself using imshow(image, [low
> high]), however i cannot save this information as a new
> seperate image/variable...any thoughts? sorry if this is
> basic but i am a beginner....
> -Ben

Subject: imwrite-saving a modified image

From: ben

Date: 10 Dec, 2007 15:50:25

Message: 3 of 5

Ok, i am not yet trying to turn the image into b/w. what i
am looking to do is to save the image i have "windowed"
with imshow so that i can do other manipulations or
calculations to it. For example, i am looking at CT scans.
You see different tissues having different intensities and
with the histogram and imshow you can sort of isolate the
different tissues. Then to get the area of a specific
feature I would like to subtract the images i have produced
from each other...only thing is i cant figure out how to do
this without making it a new variable, which is my
problem...thanks though!
-ben
"Jason Brown" <jeb8828@rit.edu> wrote in message <fjjmp6
$sgd$1@fred.mathworks.com>...
> Ben,
>
> When I do this type of routine I use the find function in
> matlab and search for areas below and above the "low" and
> 'high" values I'm interested in. Then you can set the
> selected range to be black.
>
> ex:
>
> selected = find(image<low);
> image(selected)=0;
>
> -Jason
>
> "ben " <badler10@yahoo.com> wrote in message
> <fjjlpv$ed7$1@fred.mathworks.com>...
> > Hi, i am trying to modify an image based on the
histogram
> > of the pixel grayscale values in the unmodified image.
i
> > can do the modification itself using imshow(image, [low
> > high]), however i cannot save this information as a new
> > seperate image/variable...any thoughts? sorry if this
is
> > basic but i am a beginner....
> > -Ben
>

Subject: imwrite-saving a modified image

From: jason

Date: 10 Dec, 2007 19:38:00

Message: 4 of 5

if you have the image in a figure you could do the
following:

fig1=figure;
imshow(image,[low high]);
ax1=gca;
newimage=get(get(ax1,'children'),'cdata');
that should extract the current image from the figure

HTH
Jason

Subject: imwrite-saving a modified image

From: ben

Date: 10 Dec, 2007 20:09:51

Message: 5 of 5

Thanks for the feedback...i may have missed something in
your code, as it spit back my original image. I will keep
working on it. In the meantime though i found a better
solution for my problem, which allows me to threshold at
the same time. I can get the image i am looking for using
im2bw(image, level), where the level is of course the
threshold based on the histogram. You need to be able to
convert your colorscale to the appropriate threshold, but
that is not difficult (in the case of grayscale simply
divide your level by 255) and that way users only need to
input one number. thanks again for the help!
-ben
"jason " <mcmains.1@osu.edu> wrote in message
<fjk4in$iim$1@fred.mathworks.com>...
> if you have the image in a figure you could do the
> following:
>
> fig1=figure;
> imshow(image,[low high]);
> ax1=gca;
> newimage=get(get(ax1,'children'),'cdata');
> that should extract the current image from the figure
>
> HTH
> Jason

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
imwrite ben 10 Dec, 2007 10:33:31
save ben 10 Dec, 2007 10:33:31
image ben 10 Dec, 2007 10:33:31
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com