|
On Thu, 02 Jul 2009 06:45:07 -0400, Pascal Steiss
<_NO-SPAM_pascal.steiss@gmx.ch> wrote:
> Dear community
>
> I rendered some scientific stuff.
> Now I want to put the parameters on the frames.
> I thought of using Matlab.
>
> -- snip --
> fileNamePrefix = 'SplitRecombMovie0';
> for i=660:700
> fileName = [fileNamePrefix, num2str(i), '.bmp'];
> image = imread(fileName);
> imagesc(image);
>
> set(gca,'DataAspectRatio', [1,1,1],'PlotBoxAspectRatio',[1 1 1])
> set(gca, 'Box', 'off', 'GridLineStyle', 'none', 'XGrid', 'off',
> 'XTick', [], 'YTick', []);
> text('String', ['P_{mw}=', num2str((i-660)*120/(831-660),3), ' mW'],
> 'Position', [600, 80], 'Color', 'white', 'FontSize', 15);
> f = getframe(gca);
> imwrite(f.cdata, [num2str(i), '.bmp']);
> end;
> -- snap --
>
> Now my problem: The original files have a size of 800 x 600 pixels.
>
> What I get with imwrite does not have 800x600 Pixels.
> How do I tell the axes object to have exactly an extend of 800 x 600
> pixels on my screen so that imwrite produces figures of 800x600 px?
>
> Thank you
> Pascal
I expected GETFRAME to work on the pixels in the axis, fooling around led
me here:
(something to start with for you)
imagesc(rand(600,800));
set(gca,'DataAspectRatio', [1,1,1],'PlotBoxAspectRatio',[1 1 1])
set(gca, 'Box', 'off', 'GridLineStyle', 'none', 'XGrid', 'off',...
'XTick', [], 'YTick', []);
text('String', ['P_{mw}=', num2str((i-660)*120/(831-660),3), ' mW'],...
'Position', [400, 80], 'Color', 'black', 'FontSize', 15);
set(gcf,'position',[50 50 810 610]); %something larger than the axis
set(gca,'Units','pixels'); %easier to specify
set(gca,'position',[8 8 800 599]); %
f = getframe(gca);size(f.cdata)
%imwrite(f.cdata,'o.bmp');
|