没有合适的资源?快使用搜索试试~ 我知道了~
Sample Project Solutions(Digital Image Processing Using MATLAB)
1星 需积分: 9 14 下载量 8 浏览量
2015-10-24
21:10:24
上传
评论
收藏 4.48MB PDF 举报
温馨提示
Sample Project Solutions for Digital Image Processing Using MATLAB(2nd edition)Rafael C. Gonzalez Richard E. Woods Steven L. Eddins
资源推荐
资源详情
资源评论
Sample Project Solutions
for
Digital Image Processing Using MATLAB
®
2nd edition
Rafael C. Gonzalez
Richard E. Woods
Steven L. Eddins
©2009
Gatesmark Publishing
a division of Gatesmark, LLC
ISBN: 9780982085400
Book web site: www.imageprocessingplace.com
Version 1.0
May 1, 2009
© 2009. This publication is protected by United States and international copyright laws, and is designed
exclusively to assist instructors in teaching their courses or for individual use. Publication, sale, or other type of
widespread dissemination (i.e. dissemination of more than extremely limited extracts within the classroom
setting) of any part of this material (such as by posting it on the World Wide Web) is not authorized, and any
such dissemination is a violation of copyright laws.
Project Solutions Page 2
Introduction
This document contains solutions to all the sample projects listed in the book web site. These projects are
intended to serve as guidelines for formulating projects dealing with other topics in the book.
The projects range in complexity from straightforward extensions of the material in the book to more
comprehensive undertakings that require several hours to solve. All the material required for the projects is
contained in the book web site. Normally, the solutions are based on material that has been covered up to the
chapter in question, but we often use material from later chapters in order to arrive at a well-formulated
solution. In these instances, we indicate where the needed material is located in the book and, on rare
occasions, we point to online resources.
One of the most interesting aspects of a course in digital image processing in an academic environment is
the pictorial nature of the subject. It has been our experience that students truly enjoy and benefit from judicious
use of computer projects to complement the material covered in class. Since computer projects are in addition to
course work and homework assignments, we try to keep the formal project reporting as brief as possible. In
order to facilitate grading, we try to achieve uniformity in the way project reports are prepared. A useful report
format is as follows:
Page 1: Cover page.
Project title
Project number
Course number
Student’s name
Date due
Date handed in
Abstract (not to exceed ½ page).
Page 2: One to two pages (max) of technical discussion.
Page 3 (or 4): Discussion of results. One to two pages (max).
Results: Image results (printed typically on a laser or inkjet printer). All images must contain a number and title
referred to in the discussion of results.
Appendix: Program listings, focused on any original code prepared by the student. For brevity, functions and
routines provided to the student are referred to by name, but the code is not included.
Layout: The entire report must be on a standard sheet size (e.g., 8.5 by 11 inches), stapled with three or more
staples on the left margin to form a booklet, or bound using a clear cover, standard binding product.
Although formal project reporting of the nature just discussed is not typical in an independent study or
industrial/research environment, the projects outline in this document offer valuable extensions to the material
in the book, where lengthy examples are kept to a minimum for the sake of space and continuity in the
discussion. Image processing is a highly experimental field and MATLAB, along with the Image Processing
Project Solutions Page 3
Toolbox, offers an unparalleled software development environment. By taking advantage of MATLAB’s
vectorization capabilities solutions can be made to run fast and efficiently, a feature that is especially important
when working with large image data bases. The use of DIPUM Toolbox functions is encouraged in order to
save time in arriving at project solutions and also as exercises for becoming more familiar with these functions.
The reader will find the projects in this document to be useful for both learning purposes and as a reference
source for ideas on how to attack problems of practical interest. As a rule, we have made an effort to match the
complexity of projects to the material that has been covered up to the chapter in which the project is assigned.
When one or more functions that have not been covered are important in arriving at a well-formulated solution,
we generally suggest in the problem statement that the reader should become familiar with the needed
function(s).
As will become evident in the solution material that follows, there usually isn’t a single, “best” solution to a
given project. The following criteria can be used as a guide when a project calls for new code to be developed:
How quickly can I implement this solution?
How robust is the solution for “rare” cases?
How fast does the solution run?
How much memory does the solution require?
How easy is the code to read, understand, and modify?
We offer multiple solutions to some projects to illustrate these points (e.g., see the solutions to Project 2.1).
Also, it is important to keep in mind that solutions can change over time, as new MATLAB or Image
Processing Toolbox functions become available.
Project Solutions Page 4
Chapter 2
Sample Project Solutions
PROJECT 2.1
MATLAB does not have a function to determine which elements of an array are integers (i.e., . . ., 2, 1, 0, 1, 2
, . . .). Write a function for this purpose, with the following specifications:
function I = isinteger(A)
%ISINTEGER Determines which elements of an array are integers.
% I = ISINTEGER(A) returns a logical array, I, of the same size
% as A, with 1s (TRUE) in the locations corresponding to integers
% (i.e., . . . -2 -1 0 1 2 . . . )in A, and 0s (FALSE) elsewhere.
% A must be a numeric array.
Use of while or for loops is not allowed. Note: Integer and double-precision arrays with real or complex
values are numeric, while strings, cell arrays, and structure arrays are not. Hints: Become familiar with
function floor. If you include the capability to handle complex numbers, become familiar with functions
real and imag.
SOLUTIONS
Three solutions are provided. Solution 1 is a quick, easy-to-understand implementation that is acceptable for
“most” purposes. It isn’t perfect, however. For example, it returns true (1) for
Inf, -Inf, and for complex
numbers whose real and imaginary parts are integers, such as 1 + i. Solution 2 addresses these problems. It
has the advantage of being more robust, but it has the disadvantage of taking more time to run because of the
extra checks. Also, Solution 2 always converts A to double, which is unnecessary work for the integer-class
arrays. Solution 3 adds additional logic to avoid the double conversion when it is not needed. It is therefore
faster than the other solutions if the input has integer class. The disadvantage of Solution 3 is that the code is
longer and more difficult to understand, especially compared with Solution 1.
SOLUTION 1
function I = isinteger1(A)
%ISINTEGER1 Determines which elements of an array are integers.
% I = ISINTEGER1(A) returns a logical array, I, of the same size
% as A, with 1s (TRUE) in the locations corresponding to integers
% (i.e., . . . -2, -1, 0, 1, 2, . . . )in A, and 0s (FALSE) elsewhere.
% A must be a numeric array.
% Copyright 2009 R. C. Gonzalez, R. E. Woods, & S. L. Eddins
% For use with Digital Image Processing Using MATLAB, 2nd ed.
% Gatesmark Publishing, 2009.
% $Revision: 1.1 $ $Date: 2009/03/15 00:19:03 $
% Check the validity of A.
if ~isnumeric(A)
error('A must be a numeric array.');
end
Project Solutions Page 5
A = double(A);
I = A == floor(A);
SOLUTION 2
function I = isinteger2(A)
%ISINTEGER2 Determines which elements of an array are integers.
% I = ISINTEGER2(A) returns a logical array, I, of the same size
% as A, with 1s (TRUE) in the locations corresponding to integers
% (i.e., . . . -2, -1, 0, 1, 2, . . . )in A, and 0s (FALSE) elsewhere.
% A must be a numeric array.
% Copyright 2009 R. C. Gonzalez, R. E. Woods, & S. L. Eddins
% For use with Digital Image Processing Using MATLAB, 2nd ed.
% Gatesmark Publishing, 2009.
% $Revision: 1.1 $ $Date: 2009/03/15 00:19:03 $
% Check the validity of A.
if ~isnumeric(A)
error('A must be a numeric array.');
end
A = double(A);
I = isfinite(A) & (imag(A) == 0) & (A == floor(A));
SOLUTION 3
function I = isinteger3(A)
%ISINTEGER3 Determines which elements of an array are integers.
% I = ISINTEGER3(A) returns a logical array, I, of the same size
% as A, with 1s (TRUE) in the locations corresponding to integers
% (i.e., . . . -2, -1, 0, 1, 2, . . . )in A, and 0s (FALSE) elsewhere.
% A must be a numeric array.
% Copyright 2009 R. C. Gonzalez, R. E. Woods, & S. L. Eddins
% For use with Digital Image Processing Using MATLAB, 2nd ed.
% Gatesmark Publishing, 2009.
% $Revision: 1.1 $ $Date: 2009/03/15 00:19:04 $
% Check the validity of A.
if ~isnumeric(A)
error('A must be a numeric array.');
end
if isa(A, 'double')
I = isfinite(A) & (imag(A) == 0) & (A == floor(A));
elseif isa(A, 'single')
A = double(A);
I = isfinite(A) & (imag(A) == 0) & (A == floor(A));
else
% A must be one of the integer types, so we don't have to convert
% to double.
if isreal(A)
I = true(size(A));
else
I = imag(A) == 0;
end
end
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
PROJECT 2.2
MATLAB does not have a function to determine which elements of an array are even numbers (i.e., . . . 4, 2,
0, 2, 4 , . . .). Write a function for this purpose, with the following specifications:
剩余44页未读,继续阅读
资源评论
- zxpddfg2019-01-08脑袋进水了,花了10积分下载这没用的东西
sooAnderson
- 粉丝: 227
- 资源: 57
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 从 Python 访问 Java 类.zip
- 交互式 JavaScript 沙箱.zip
- 交互式 JavaScript API 参考.zip
- 使用SSM框架的Java Web项目-电商后台管理.zip
- 与 FrontendMasters 课程 JavaScript 和 React 模式相关的 repo.zip
- win11系统有ie浏览器,打开ie浏览器自动跳转edge浏览器解决方案
- 基于Spark的新闻推荐系统源码+文档说明(高分项目)
- 27个常用分布函数详细汇总-名称+类别+用途+概率密度曲线+公式-PPT版本
- Python毕业设计基于时空图卷积ST-GCN的骨骼动作识别项目源码+文档说明(高分项目)
- 一个易于使用的多线程库,用于用 Java 创建 Discord 机器人 .zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功