For Programmers: Free Programming Magazines  


Home > Archive > Matlab > November 2005 > writting an array as an image









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author writting an array as an image
ganesh

2005-11-30, 4:02 am

hi
i have a small problem. my code generates contour of a grayscale
image based on given threshold limit( between 0 to 255). the contour
is plotted using the command 'plot'.
the input for the command plot is the array which stores the info
about all data points on the contour.( for ex.
c1=contourc(image1,[250,250]) %% gets the matrix c1 which
stores the x and y
co-ordinates of all the
points in image1 which are
at grayscale 250.

plot(c1(1,2:500),c1(2,2:500),'-k'); %% plots the data
%% of the points btwn
%% 2:500

now the problem is when i get a plot using above command,it will be a
..fig file. how do we save the current file as .jpg or .bmp file at a
specified location? note that when i use
h=plot(c1(1,2:500),c1(2,2:500),'-k'); the result h,is a column
vector of handles. but i want a variable that could store the contour
plot as .jpg or .bmp or .fig file.
how do we save this file?
thanks..!
regards,
ganesh.
Dav

2005-11-30, 4:02 am

Hi,

An image can be saved using the imwrite command. Grayscale images are
normally store in the tif format if you're using uint8 precision to
represent your image. I would use "imshow" to make sure that the image
displays correctly before attemting to save. Also images can be easily
displayed using imagesc. This scales images images automatically. I
would encourage you to use the matlab help to review the function of
each of the commands and perhaps try out any examples you may see.

best regards,
David

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com