毕业设计——人脸检测——001 图片导入MATLAB
2011-11-13 06:46
495 查看
问题:如何导入图片到MATLAB
解决:
Image1 = imread('E:\Graduate project\Database\test\subject01.centerlight.gif'); % 括号内为绝对路径Image2 = imread('subject01.centerlight.gif'); %使用文件相对路径
Image3 = imread('subject01.centerlight','GIF'); %注意文件只有文件名,无后缀(不区分大小写),记着加引号
imshow(Image1);%显示
IMREAD Read image from graphics file.
A = IMREAD(FILENAME,FMT) reads a grayscale or color image from the file specified by the string FILENAME. If the file is not in the current directory, or in
a directory on the MATLAB path, specify the full pathname.
The text string FMT specifies the format of the file by its standard file extension. For example, specify 'gif' for Graphics Interchange Format files.
To see a list of supported formats, with their file extensions, use the IMFORMATS function. If IMREAD cannot find a file named FILENAME, it looks for a file named FILENAME.FMT.
The return value A is an array containing the image data. If the file contains a gray scale image, A is an M-by-N array. If the file contains a true
color image, A is an M-by-N-by-3 array. For TIFF files containing color images that use the CMYK color space, A is an M-by-N-by-4 array. See TIFF in the Format-Specific Information section
for more information.
上面英文帮助来自MATLAB帮助文档(在MATLAB Command Window使用‘help imread’可以查询到)
MATLAB注释方式:
A、
%{
若干语句,测试可以使用,注意括号都在百分号后面
%}
B、
多行注释: 选中要注释的若干语句, 编辑器菜单Text->Comment, 或者快捷键Ctrl+R
取消注释: 选中要取消注释的语句, 编辑器菜单Text->Uncomment, 或者快捷键Ctrl+T
(Ctrl+R注释多行,Ctrl+T取消注释)
C、
if LOGICAL(0)
若干语句
end
这个方法实际上是通过逻辑判断语句不执行相关的语句
最后一种方法还没有测试使用过,会在以后的学习中测试(???)
注释方法参考:http://icictech.blog.163.com/blog/static/2797425420084595725499/
http://blog.sciencenet.cn/home.php?mod=space&uid=296318&do=blog&id=273228
用类似下面的语句导入多幅图片数据:
geshi = {'*.jpg','JPEG image (*.jpg)';... '*.bmp','Bitmap image (*.bmp)';... '*.*','All Files (*.*)'}; [FileName FilePath] = uigetfile(geshi,'导入外部图片','*.jpg','MultiSelect','on'); if ~isequal([FileName,FilePath],[0,0]); FileFullName = strcat(FilePath,FileName); if iscell(FileName) FileFullName = FileFullName([2:end 1])'; FileName = FileName([2:end 1])'; else FileName = {FileName}; FileFullName = {FileFullName}; end else return; end n = length(FileFullName); for i=1:n Ii = imread(FileFullName{i}); end上面方法来自:http://www.matlabsky.com/thread-13432-1-1.html @xiezhh
相关链接还有:http://www.ilovematlab.cn/thread-27106-1-1.html
http://www.paper.edu.cn/paper.php?serial_number=200812-844 图片导入matlab后色彩分量矩阵的处理
在此对各位表示谢意
相关文章推荐
- 毕业设计——人脸检测——004 学习别人代码——《matlab读取一个目录下的所有图片》
- 毕业设计——人脸检测——002 MATLAB实现提取一张图片像素点的RGB值
- 毕业设计——人脸检测——MATLAB 在图片上画矩形框(已知矩形左上角坐标、长、宽)
- opencv3.1图片相似度对比和人脸检测裁剪
- 基于PCA的人脸检测(Matlab版代码)
- PCA检测人脸的简单示例_matlab实现
- PCA检测人脸的简单示例_matlab实现
- 在opencv3中进行图片人脸检测
- 模式识别,图片边缘检测matlab代码
- 基于肤色和眼睛定位的人脸检测算法——MATLAB实现
- 【matlab图像处理】图片生成线条效果(边缘检测)
- matlab—GUI实现摄像头人脸检测
- PCA检测人脸的简单示例_matlab实现
- Python爬虫 + 人脸检测 + 颜值检测 = 知乎高颜值图片抓取
- 从视频中提取图片,对图片做人脸检测并截取人脸区域
- 毕业设计——人脸检测——AdaBoost
- 从matlab导入fig图片数据并设定输出大小
- 从matlab导入fig图片数据并设定输出大小
- Matlab基于Viola-Jones算法的人脸检测(1)
- PCA检测人脸的简单示例_matlab实现