Path: news.mathworks.com!not-for-mail
From: "Dan Haeg" <haegd@msoe.edu>
Newsgroups: comp.soft-sys.matlab
Subject: saving image with plot
Date: Wed, 26 Mar 2008 20:44:02 +0000 (UTC)
Organization: Milwaukee School of Engineering
Lines: 56
Message-ID: <fsecii$kgn$1@fred.mathworks.com>
Reply-To: "Dan Haeg" <haegd@msoe.edu>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1206564242 21015 172.30.248.37 (26 Mar 2008 20:44:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 26 Mar 2008 20:44:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 475291
Xref: news.mathworks.com comp.soft-sys.matlab:459355



I have an image of a marine chart. I imported the image into
matlab and figured out how to register pixel locations with
latitude and longitude. Next I converted some GPS data from
[latitude, longitude] pairs into pixel coordinates and
plotted a track on top of the image. The only way I can
figure out how to save the image with the track is to use
the print command and save it to a jpeg.

Does anyone know how to save the resulting image with the
same resolution as the original image. 

Here is what I am doing:
A = imread(filename, fmt);
s=size(A);
x=rand(s(1))*s(1);%for example
y=rand(s(2))*s(2);%for example
figure
image(A)
hold on
plot(x,y)
print -djpeg -r1000 chartwithtrack

I would like to be able to change the pixels in A where the
line is plotted. I know it is easy to change pixels at each
data point, but I do not know of an elegant way to connect
the data points without using plot. Then I could just save A
with:
imwrite(A,filename,fmt)

Any help would be appreciated.
Dan Haeg

Here are the toolboxes I have:
Operating System: Microsoft Windows XP Version 5.1 (Build
2600: Service Pack 2)
Java VM Version: Java 1.5.0_07 with Sun Microsystems Inc.
Java HotSpot(TM) Client VM mixed mode
-----------------------------------------------------------
MATLAB                         Version 7.4        (R2007a)
Simulink                       Version 6.6        (R2007a)
Communications Blockset        Version 3.5        (R2007a)
Communications Toolbox         Version 3.5        (R2007a)
Control System Toolbox         Version 8.0        (R2007a)
Extended Symbolic Math Toolbox Version 3.2        (R2007a)
Fuzzy Logic Toolbox            Version 2.2.5      (R2007a)
Image Processing Toolbox       Version 5.4        (R2007a)
MATLAB Compiler                Version 4.6        (R2007a)
Neural Network Toolbox         Version 5.0.2      (R2007a)
Partial Differential Equation Toolbox                
Version 1.0.10     (R2007a)
Real-Time Workshop             Version 6.6        (R2007a)
Signal Processing Blockset     Version 6.5        (R2007a)
Signal Processing Toolbox      Version 6.7        (R2007a)
Simulink Control Design        Version 2.1        (R2007a)
Statistics Toolbox             Version 6.0        (R2007a)
Symbolic Math Toolbox          Version 3.2        (R2007a)