MATLAB 图像处理笔记

本笔记整合了之前在作业部落上的现代通信技术笔记. 又融合了数字图像处理课程的实验笔记.

图像读取

主要函数有 imread(FILENAME) imshow(A) rgb2gray(RGB)

repmat 函数

MATLAB中如果想对一个矩阵或向量进行复制填充成一个新的矩阵怎么办?就用repmat函数。
示例:

1
2
x = [1 2 3];
y = repmat(x, 2, 1); // 构建x作为子矩阵,构建两行一列子矩阵的合成矩阵

exist 函数

MATLAB中有一个非常强大的检查某个名称是否存在的函数,exist(str)。

下面是help出来的官方说明文档

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
exist  Check existence of variable, script, function, folder, or class
exist(NAME) returns:
0 if NAME does not exist
1 if NAME is a variable in the workspace
2 if NAME is a file with extension .m, .mlx, or .mlapp, or NAME
is the name of a file with a non-registered file extension
(.mat, .fig, .txt).
3 if NAME is a MEX-file on the MATLAB search path
4 if NAME is a Simulink model or library file on the MATLAB search path
5 if NAME is a built-in MATLAB function. This does not include classes
6 if NAME is a P-code file on the MATLAB search path
7 if NAME is a folder
8 if NAME is a class (exist returns 0 for Java classes if you
start MATLAB with the -nojvm option.)

exist('NAME','builtin') checks only for built-in functions.
exist('NAME','class') checks only for classes.
exist('NAME','dir') checks only for folders.
exist('NAME','file') checks for files or folders.
exist('NAME','var') checks only for variables.

NAME can include a partial path, but must be in a folder on the search
path, or in the current folder. Otherwise, name must include a full path.

If NAME specifies a file with a non-registered file extension
(.mat, .fig, .txt), include the extension.

NAME is case insensitive on Windows systems, and case sensitive for
files and folder on UNIX systems.

MATLAB does not examine the contents or internal structure of a file
and relies solely on the file extension for classification.

可以用exist('NAME','var')检查变量NAME是否存在。

如何做一个绅士 数字图像处理项目调研

评论

You forgot to set the shortname for Disqus. Please set it in _config.yml.
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×