imwrite可用于将一张真彩色jpg格式图片转换为灰度图像、索引图像、二值图像
B = imresize(A, m)
返回的图像B的长宽是图像A的长宽的m倍,即缩放图像。 m大于1, 则放大图像; m小于1, 缩小图像。
close 关闭图像
close all关闭所有图像
size(image); %图像的尺寸信息
打开所有图像
http://zhidao.baidu.com/link?url=-y9B0eVfWYaIkWBUq1x1L9X7NAEp2RSh3WhWgdruSxsYB9c_t9wbVziQkDA6MWnxSTUiWVg87PBTPXv25fME34cSgfNjd4dayVhImzum6hm
fopen('tmp.pgm', 'w');打开图像
r 以只读方式打开文件,该文件必须存在。
r+ 以可读写方式打开文件,该文件必须存在。
rb+ 读写打开一个二进制文件,允许读写数据,文件必须存在。
w 打开只写文件,若文件存在则文件长度清为0,即该文件内容会消失。若文件不存在则建立该文件。
w+ 打开可读写文件,若文件存在则文件长度清为零,即该文件内容会消失。若文件不存在则建立该文件。
a 以附加的方式打开只写文件。若文件不存在,则会建立该文件,如果文件存在,写入的数据会被加到文件尾,即文件原先的内容会被保留。(EOF符保留)
a+ 以附加方式打开可读写的文件。若文件不存在,则会建立该文件,如果文件存在,写入的数据会被加到文件尾后,即文件原先的内容会被保留。 (原来的EOF符不保留)
wb 只写打开或新建一个二进制文件;只允许写数据。
wb+ 读写打开或建立一个二进制文件,允许读和写。
ab+ 读写打开一个二进制文件,允许读或在文件末追加数据。
clear清空工作区间变量
clc清空输入窗
fprintf(f, 'P5\n%d\n%d\n255\n', cols, rows);%输出P5、clos、rows、255到f所指的文本文件中。
%image'对image转置
fwrite是将Matlab数值转换成特定精度数并保存到特定的文件中去,并以列序保存.
imwrite是用来生成图象格式的文件的
Matlab的fwrite()函数和fread()函数都是将从文件中读进来的数据按列顺序存放在矩阵中的。
data = fscanf(fid,format,size);
期中data为读取内容的数组,他的大小由size决定。size是一个[m n]的向量,
m为行,n为列http://blog.sina.com.cn/s/blog_66d362d701017q2o.html
http://sxyd.sdut.edu.cn/gaoshu1/lesson/3.3%20%20tailegongshi.htm
*代表变量相乘,或者矩阵相乘 .*是矩阵中对应位置变量相乘,组成新得矩阵
save test.mat A
>> save testtext.txt A –ascii
A' % 转置prod(a)相乘
temp=pinv(A) %矩阵求逆
>t=[0:0.01:0.98];
>> y1=sin(2*pi*4*t);
>> plot(t,y1)
floor(a)%取下界 ceil(a)%取上界
>> hold on;%plotnew figure on the old ones
>> y2=cos(2*pi*4*t);
>> plot(t,y2,'r')%RGB颜色
xlabel('time')
>> ylabel('value')
>> legend('sin','cos')
>> title('my plot')
>> print -dpng 'myplot.png'%save as a file in default catalog
>> close
%一幅图中显示两个subplot
figure
subplot(1,2,1);plot(t,y1)
subplot(1,2,2);plot(t,y2)
axis([0.5 1 -1 1])%axis([xmin xmax ymin ymax])
A=magic(5)
imagesc(A)%displays A as an image.
imagesc(A),colorbar,colormap gray;%adds a new vertical colorbar on the right side of the current axes;sets the colormap to the matrix map.disp %displays the contents of X without printing the variable name.
fittype Fittype for curve and surface fitting
polyfit - Polynomial curve fitting p = polyfit(x,y,n) y=kx+b;n为次方
linspace - Generate linearly spaced vectors , This MATLAB function generates a row vector y of 100 points linearly spaced between and including a and b.
polyval - Polynomial evaluation
- %show results
- scatter(x,y);%以圆的形式标注点。