I have 50 jpeg files and i applied some dimension application i.e
d
r1=m_s_p___1_(1401:1430,2001:2030,:); from whos after import it the file m.s.p (1).jpg
image (r1) => show plot tool =>axis no title and save as it r1.jpg again
I have to do this for 50 images.
but i cannot save it via imwrite after i get r1=m_s_p___1_(1401:1430,2001:2030,:); in whos 30x30x3 then if i imwrite it , it will give a 30x30 jpeg but if i open in matlab then save as in file with no axis title it give me 420x560x3 matrices?? i confused how why it is happened?
|
|
0
|
|
|
|
Reply
|
murat
|
11/9/2010 7:51:04 AM |
|
i have the m.s.p (1).jpg to 50 images in a file..
i can import it to workspace as a m_s_p___(1)
then r1=m_s_p___1_(1401:1430, 2001:2030,:);
and image (r1) after i see the image show tool plot and unchecked axis no title later file save as jpeg r1.jpg...
i tried it with imwrite it save 30x30 but the file r1 saved like the function above it gives me 560x420 image.. so how can i deal with this problem and i have to do it for loop in 50 times.
|
|
0
|
|
|
|
Reply
|
murat
|
11/9/2010 8:19:04 AM
|
|
for K=1:2;
inname = sprintf('m.s.p (%d).jpg', K);
outname = sprintf('r%d', K);
a = imread(inname);
a = a(1401:1430, 2001:2030,:);
a = imresize(a, [420 560]);
imwrite(a, outname.jpg, 'jpg');
end
i tried this but not save the files with *.jpg suffex. ?
|
|
0
|
|
|
|
Reply
|
murat
|
11/9/2010 9:27:05 AM
|
|
Like I said in your prior thread (i.e. you shouldn't have started this
one):
You should give your filename an extension
outname = sprintf('r%d.jpg', K);
Then pass in that string, without a member. You added .jpg onto the
string which made MATLAB assume that outname was a structure. Do
this:
imwrite(a,outname, 'jpg');
You'd also be better off if you chose a folder and used fullfile().
|
|
0
|
|
|
|
Reply
|
ImageAnalyst
|
11/9/2010 11:21:05 AM
|
|
ImageAnalyst <imageanalyst@mailinator.com> wrote in message <0b3f4d13-5f51-4a25-8e57-5463e43b432c@o23g2000prh.googlegroups.com>...
> Like I said in your prior thread (i.e. you shouldn't have started this
> one):
>
> You should give your filename an extension
> outname = sprintf('r%d.jpg', K);
> Then pass in that string, without a member. You added .jpg onto the
> string which made MATLAB assume that outname was a structure. Do
> this:
> imwrite(a,outname, 'jpg');
> You'd also be better off if you chose a folder and used fullfile().
thanks for your help.. but i dont understand wht you say in last sentence?
|
|
0
|
|
|
|
Reply
|
murat
|
11/9/2010 11:54:06 AM
|
|
On Nov 9, 6:54=A0am, "murat " <murat...@gmail.com> wrote:
> ImageAnalyst <imageanal...@mailinator.com> wrote in message <0b3f4d13-5f5=
1-4a25-8e57-5463e43b4...@o23g2000prh.googlegroups.com>...
> > You'd also be better off if you chose a folder and used fullfile().
>
> thanks for your help.. but i dont understand wht you say in last sentence=
?
---------------------------------------------------------------------------=
-------------------------------------
It's not a good idea to just save files in whatever happens to be the
current working directory. What if it gets changed on you? You'd now
be saving the files into a different folder than you thought. You're
best off either hard coding a permanent folder into your source code,
or asking the user where they want to save their files. Then use that
in fullfile. For example, something like this (untested)
returnValue =3D uigetdir(handles.ImageFolder,'Select folder');
% returnValue will be 0 (a double) if they click cancel.
% returnValue will be the path (a string) if they clicked OK.
if returnValue ~=3D 0
% Assign the value if they didn't click cancel.
% Convert backslashes to forward slashes for compatibility with Unix
systems.
returnValue =3D strrep(returnValue, '\', '/');
folder =3D returnValue;
baseFileName =3D sprintf('m.s.p (%d).jpg', K);
fullFileName =3D fullfile(folder, baseFileName);
imwrite(imageArray, fullFileName);
end
|
|
0
|
|
|
|
Reply
|
ImageAnalyst
|
11/9/2010 12:52:47 PM
|
|
ImageAnalyst <imageanalyst@mailinator.com> wrote in message <1bd3758e-3865-4713-a4c3-a6bcf38dfeac@o11g2000prf.googlegroups.com>...
> On Nov 9, 6:54 am, "murat " <murat...@gmail.com> wrote:
> > ImageAnalyst <imageanal...@mailinator.com> wrote in message <0b3f4d13-5f51-4a25-8e57-5463e43b4...@o23g2000prh.googlegroups.com>...
> > > You'd also be better off if you chose a folder and used fullfile().
> >
> > thanks for your help.. but i dont understand wht you say in last sentence?
> ----------------------------------------------------------------------------------------------------------------
> It's not a good idea to just save files in whatever happens to be the
> current working directory. What if it gets changed on you? You'd now
> be saving the files into a different folder than you thought. You're
> best off either hard coding a permanent folder into your source code,
> or asking the user where they want to save their files. Then use that
> in fullfile. For example, something like this (untested)
>
> returnValue = uigetdir(handles.ImageFolder,'Select folder');
> % returnValue will be 0 (a double) if they click cancel.
> % returnValue will be the path (a string) if they clicked OK.
> if returnValue ~= 0
> % Assign the value if they didn't click cancel.
> % Convert backslashes to forward slashes for compatibility with Unix
> systems.
> returnValue = strrep(returnValue, '\', '/');
> folder = returnValue;
> baseFileName = sprintf('m.s.p (%d).jpg', K);
> fullFileName = fullfile(folder, baseFileName);
> imwrite(imageArray, fullFileName);
> end
>
i tried this code but it is not correctly worked it opns the box to select folder but not save it then not started ..
|
|
0
|
|
|
|
Reply
|
murat
|
11/10/2010 1:16:04 PM
|
|
|
6 Replies
447 Views
(page loaded in 0.073 seconds)
Similiar Articles: save image with no axis title. ? imwrite or another - comp.soft ...I have 50 jpeg files and i applied some dimension application i.e d r1=m_s_p___1_(1401:1430,2001:2030,:); from whos after import it the file m.s.p (1).jpg image (r1 ... how to save PNG file with imwrite function? - comp.soft-sys.matlab ...save image with no axis title. ? imwrite or another - comp.soft ... how to save PNG file with imwrite function? - comp.soft-sys.matlab ... saving an image - comp.soft-sys ... live video handles is run in other axes when doing process of ...save image with no axis title. ? imwrite or another - comp.soft ... live video handles is run in other axes when doing process of ... save image with no axis title ... save to specified folder - comp.soft-sys.matlabsave image with no axis title. ? imwrite or another - comp.soft ... Save output image file in a specified folder - comp.graphics.apps ... I need help in how to write the ... GUI - Clean Workspace - comp.soft-sys.matlabsave image with no axis title. ? imwrite or another - comp.soft ... GUI - Clean Workspace - comp.soft-sys.matlab save image with no axis title. ? imwrite or another - comp ... Hp50g how do I erase individual plot functions - comp.sys.hp48 ...You can then use left shift EQ to save the edited list ... function, then get out of the plot screen and plot another ... graphics" screen (on which plots are plotted or images ... how to do running max fast in Matlab? - comp.soft-sys.matlab ...save image with no axis title. ? imwrite or another - comp.soft ... how to do running max fast in Matlab? - comp.soft-sys.matlab ... fontSize = 20; if nargin == 0 % No ... How to save files into a specific folder - comp.soft-sys.matlab ...subPlot(1, 3, 2); axis off; % Turn off axes numbers. title('Movie ... numK=num2str(k); > imwrite(Vid(i).cdata ... Save output image file in a specified folder ... create plot and save it without opening figure window - comp.soft ...... plot, change some properties like axis, title and then save this a ... I just found imwrite() but I'm not sure how to ... for now I use the print() function to save my image ... display video in a GUI - comp.soft-sys.matlab... promptMessage, 'Save individual frames?', 'Yes', 'No', 'Yes ... subPlot(1, 3, 2); axis off; % Turn off axes numbers. title ... sys.matlab GUI open picture load to axis ... save image with no axis title. ? imwrite or another - comp.soft ...I have 50 jpeg files and i applied some dimension application i.e d r1=m_s_p___1_(1401:1430,2001:2030,:); from whos after import it the file m.s.p (1).jpg image (r1 ... imwrite - Write image to graphics file - MathWorks - MATLAB and ...• File Opening, Loading, and Saving • Text Files ... axis ... is of class double, and the image is an indexed image, imwrite ... 7/25/2012 1:37:11 AM
|