2007年5月31日星期四

固定Firefox窗口大小

使用Firefox是因为它有很多插件。收集很多图片是一件很累人的事情。Firefox有一个插件可以使用快捷键保存当前网页中的最大一幅图片,这就减轻了我非常大的工作量啊。可惜有一点不爽,就是打开一些网页的时候,如果使用了Tab mix,窗口大小会突然被改变。

这个问题是JavaScript引起的。进入Firefox工具-选项-内容-JavaScript-高级,取消选择移动和改变窗口大小即可解决这个问题。

英文版:

Fix the window size!

http://nw360.blogspot.com/2007/05/fix-window-size.html

2007年5月21日星期一



画纸陈书晓树风
随风水被暮霞红
情闲得意终难到
一塘花前笔砚浓

用MATLAB转换图片到avi视频

“im2avi”是一个MATLAB函数,可以转换图片到avi视频,这是一个简化版本。

function varargout=im2avi(ext, imdir, scale, framerate, filename, playflag)
% im2avi converts image sequenses to avi video
%
% SYNTAX
%
% Inputs: imdir: image sequense directory
% ext: the extension name of the image such as 'jpg', 'tif',
% scale: image resize, like [320 400] or 0.9
% framerate: avi video frame rate
% filename: save avi as
% playflag: play the avi video, if it is 0, no play, if >0,
% play the avi 'playflag' times.
%
% EXAMPLE: im2avi(ext, imdir, scale, framerate, filename, playflag)
%
% NOTES: based on im2avi (author: Zhe Wu @ Univ of Rochester)
% Wenbin, 09-May-2007

warning('im2avi:warning','Do NOT close or open any image window during the process!\n')

filearray=dir([imdir filesep '*.' ext]);
s=size(filearray,1);

frameind=0;
mv =struct('cdata',{}, 'colormap', {});
figure, h =gcf;

for i=1:s
frameind=frameind+1;
imgname=[imdir filesep filearray(i).name];
im=imread(imgname) ;
im=imresize(im, scale);
imshow(im);
mv(frameind)=getframe(h);
end
close(h)

movie2avi(mv, [imdir filesep filename '.avi'], 'fps', framerate);

if nargout >0
varargout{1} =mv;
end

if playflag>0
movie(mv, playflag);
end

英文版:

Convert images to avi video in MATLAB

http://nw360.blogspot.com/2007/05/convert-images-to-avi-video.html

2007年5月17日星期四

MATLAB: 转换三维矩阵到二维

假设我们有一幅 RGB 图像,矩阵大小是M*N*3。 现在的问题是转换三维矩阵到二维维 (大小MN*3,每一列对应一个平面 R,G,B)。

这里有一段代码,是从一篇硕士论文上复制来的 (变量名字已经改变):

R =f (:,:,1);% take all of the first element
G =f (:,:,2);
B =f (:,:,3);
R =R(1:end);%make it into one column matrix
G =G(1:end);
B =B(1:end);
%concentrate these R,G,B into a single 3 dimensional matrix
imf =[R;G;B];
imf =imf';

其实这段代码冗长,可以简写为

imf= reshape(f, M*N, 3);

如果不使用函数 'reshape' , 代码同样可以改进:

R =R(:);%make it into one vector matrix
G =G(:);
B =B(:);
imf =[R,G,B];

英文版:

MATLAB: reshape 3D matrix to 2D

http://nw360.blogspot.com/2007/02/matlab-reshape-3d-matrix-to-2d.html

2007年5月7日星期一

在幻灯片中使用Latex公式

在PowerPoint中插入公式不是一件容易的事情。或者截屏,或者使用MathType。不过对于最求完美的人来说,前述方法得到的结果可能不令人满意。TexPoint 是一个不错的选择,如果它现在还是免费的话。对于TexPoint 作者说30美元不贵,我不敢苟同。

幸好,我们还有免费的选择 Tex4PPT。 借助于这个工具,你可以在PowerPoint中插入美观的LaTex的公式啦。注意,该软件兼容PowerPoint 2002及其以上,但不兼容PowerPoint 2007.

更多信息在官方主页: http://users.ecs.soton.ac.uk/~srg/softwaretools/presentation/TeX4PPT/.

英文版本:

Enhance the PowerPoint using LaTex

http://nw360.blogspot.com/2007/04/enhance-powerpoint-using-latex.html