save image with no axis title. ? imwrite or another

  • Follow


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:













7/25/2012 1:37:11 AM


Reply: