CS 659 Image Processing

CS 659 Image Processing
Homework #3
Covering Lectures 7, 8, 9 and Reading Material HW3R
NOTES: Submit only the homework “solution” (do not include these homework questions) in
Microsoft Word format to http://moodle.njit.edu/ before the above deadline. Absolutely, no late
submission is accepted. Write the answers in your own words individually. Any plagiarism will
post a “ZERO” score or cause a “FAIL” grade. The course requires Matlab programming. You can
download the Matlab software from the NJIT website: http://ist.njit.edu/software/download.php.
Submit your answer in a Microsoft Word file. Do not include the questions; just provide the
required answers in the file.
Totally, there are 5 questions. Each question is 20 points. Grading policy checks the correctness
and completion of showing resulting images, Matlab codes, and text responses.
Required reading material: HW3R
Required images: cameraman.tif, coins.png, duck.jpg
3.1 (20 points)
(a) Describe how Hough Transform can detect a straight line. Describe the step-by-step algorithm to
implement Hough Transform for detecting a straight line.
(b) Apply the Hough transform to the following image to detect lines. Show the step-by-step results
of line detection by Hough transform.
0 0 0 0 0 0 0 1
0 0 0 0 0 0 1 0
0 0 0 0 0 1 0 0
0 0 0 0 1 0 0 0
0 0 0 1 0 0 0 0
0 0 1 0 0 0 0 0
0 1 0 0 0 0 0 0
1 0 0 0 0 0 0 0
Dr. Frank Shih
(c) Read the following image: cameraman.tif which is 256 ? 256 resolution. Use program to
perform Hough transform. An example of Matlab code: x=imread(‘cameraman.tif‘);
hx=hough(x); imshow(mat2gray(hx)*1.5); The multiplication of 1.5 is just to brighten up the
image. The Hough transform function can be written as follows. Show the resulting Hough
transform image.
function res=hough(image)
% HOUGH(IMAGE) creates the Hough transform corresponding to the image IMAGE
edges=edge(image,‘canny‘);
[x,y]=find(edges);
angles=[-90:180]*pi/180;
r=floor(x*cos(angles)+y*sin(angles));
rmax=max(r(find(r>0)));
acc=zeros(rmax+1,270);
for i=1:length(x),
for j=1:270,
if r(i,j)>=0
acc(r(i,j)+1,j)=acc(r(i,j)+1,j)+1;
end;
end;
end;
res=acc;
(d) Find the maximum value of the transform using mx=max(hx(:)), and find the r and theta values
corresponding to the maximum using [r, theta]= find(hx==mx); We can create a small function,
called houghline() as below, to draw lines for us, given their perpendicular distance from the
Dr. Frank Shih
origin and the angle of the perpendicular from the x axis. Finally, we can draw the line on top
of the image using: imshow(x); houghline(x, r, theta); Show the resulting line overlapping with
the input image.
function houghline(image,r,theta)
% Draws a line at perpendicular distance R from the upper left corner of the
% current figure, with perpendicular angle THETA to the left vertical axis.
% THETA is assumed to be in degrees.
[x,y]=size(image);
angle=pi*(181-theta)/180;
X=[1:x];
if sin(angle)==0
line([r r],[0,y],‘Color‘,‘black‘)
else
line([0,y],[r/sin(angle),(r-y*cos(angle))/sin(angle)],‘Color‘,‘black‘)
end;
Answer: (a)(b)(c)(d)
3.2 (20 points)
(a) Read the image “coins.png” and display its histogram plot. Inspect the histogram near the right
of the background pixels by activating data cursor. Choose the threshold value of 120 to
generate a new threshold binary image. Display original image, its histogram plot, and the
threshold binary image.
(b) Read the input image “cameraman.tif” and compute the edges in the image using different edge
detectors like Roberts, Sobel, Prewitt, Log and Canny. Show six images using subplot with title on
each: the original image, Roberts, Sobel, Prewitt, Log and Canny.
Answer: (a)(b)
3.3 (20 points)
(a) Referring to the reading material HW3R, Fig. 4.1, design a binary image of 200 columns by 100
rows, which contains a rectangle whose length = 120 pixels and height = 60 pixels in the center.
Set the rectangle to be white and the background to be black. Use a circular structuring element
whose radius is 9 pixels to perform the following: (Hint: Matlab functions: strel(‘disk‘,9,0);
imdilate, imerode, imopen, imclose) (i) Binary dilation (ii) binary erosion (iii) binary opening,
and (iv) binary closing. Show the Matlab source code and the resulting five images: the
rectangular image, the dilated image, the eroded image, the opened image, and the closed
image.
(b) Referring to the reading material HW4R, Fig. 4.2, design a circular structuring element whose
radius is 5 pixels to perform the following operation with the input image “lena_256.bmp”:
Dr. Frank Shih
(Hint: Matlab functions: imdilate, imerode, imopen, imclose) (v) Grayscale dilation (vi)
grayscale erosion (vii) grayscale opening, and (viii) grayscale closing. Show the Matlab source
code and the resulting five images: the original Lena image, the dilated image, the eroded
image, the opened image, and the closed image.
(c) Hand calculate the morphological dilation and erosion of f and k as shown below. Use the
upper-left pixel of k as the origin. Note: do not consider the computation to the pixels which are
located outside the boundary of f.
f: k:
1 1
2 -3
Answer: (a)(b)(c)
3.4 (20 points)
(a) Hand calculates the two-step algorithm in Image Representation as follows for the city-block
distance transform on the image data below. Treat the pixels outside the image boundary to be
zeroes. Show the two output data after the first step and the second step.
(b) Repeat the same procedure for the chessboard distance transform. Show the two output data
after the first step and the second step.
bottom- to - top
right - to -left
"( ) min[ ‘( ), "( ) 1],
Ptop- to - bottom
left - to - right
00011100
11111100
11111111
11111111
11111111
11111110
Answer: (a)(b)
3.5 (20 points)
Use hand calculation to obtain the crack codes for the following binary region by using the crack
following algorithm considering 8-connectedness (so this image contains one object)? Use
hand calculation to obtain the chain codes by using the border following algorithm considering
4-connectedness (so this image contains two objects)? You need to show both (a) crack and (b)
chain codes for the following image. (Note that, using the counter-clockwise approach)
5 3 3 0
1 4 2 7
Dr. Frank Shih
0000000
0011110
0111000
0010110
0000000
Answer: (a)(b)

因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com

微信:codinghelp

原文地址:https://www.cnblogs.com/whltay/p/10548243.html

时间: 2024-10-10 10:00:51

CS 659 Image Processing的相关文章

CS 659 Image Processing and Analysis

Dr. Frank ShihCS 659 Image Processing and AnalysisResearch Paper 1 GuidelineTotal: 20%In order to obtain full credits, you need to read and follow this guideline carefully andconduct your own research independently. You could refer to the posted “Sam

Spring Cloud ZooKeeper集成Feign的坑2,服务调用了一次后第二次调用就变成了500,错误:Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.n

错误如下: 2017-09-19 15:05:24.659 INFO 9986 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.spring[email protected]56528192: startup date [Tue Sep 19 15:05:24 CST 2017]; root of context hierarchy 2017-09-19 15:05:24.858 INFO 9986 --

A trip through the Graphics Pipeline 2011_08_Pixel processing – “fork phase”

In this part, I’ll be dealing with the first half of pixel processing: dispatch and actual pixel shading. In fact, this is really what most graphics programmer think about when talking about pixel processing; the alpha blend and late Z stages we’ll e

《CS:APP》 chapter 8 Exceptional Control Flow 笔记

Exceptional Control Flow The program counter assumes a sequence of values a0,a1,...,an?1 where each ak is the address of some corresponding instruction Ik. Each transition from ak to ak +1 is called a control transfer. A sequence of such control tran

Spring MVC报异常:org.springframework.web.util.NestedServletException: Request processing failed

在使用SpringMVC绑定基本类型(如String,Integer等)参数时,应通过@RequestParam注解指定具体的参数名称,否则,当源代码在非debug模式下编译后,运行时会引发HandlerMethodInvocationException异常,这是因为只有在debug模式下编译,其参数名称才存储在编译好的代码中. 譬如下面的代码会引发异常: @RequestMapping(value = "/security/login", method = RequestMethod

Jquery.Datatables 服务器处理(Server-side processing)

  看了看介绍 http://datatables.club/manual/server-side.html 没有经过处理的分页,先显示出来看看效果,就这样写(存储过程自己写)   cshtml "serverSide": true,//服务器处理:过滤.分页.排序 "processing": true,//是否显示处理状态(排序的时候,数据很多耗费时间长的话,也会显示这个)   controller.cs //jquery.datatables public Js

Natural Language Processing with Python - Chapter 0

一年之前,我做梦也想不到会来这里写技术总结.误打误撞来到了上海西南某高校,成为了文科专业的工科男,现在每天除了膜ha,就是恶补CS.导师是做计算语言学的,所以当务之急就是先自学计算机自然语言处理,打好底子准备做科研(认真脸). 进入正题,从图书馆找了本“Natural Language Processing with Python” (影印版),书长这个样子,作者是Steven Bird, Ewan Klein和Edward Loper.粘贴个豆瓣链接供参考:https://book.douba

《CS:APP》 chapter 7 Linking 笔记

Linking Linking is the process of collecting and combining various pieces of code and data into a single file that can be loaded (copied) into memory and executed. 7.1 Compiler Drivers Most compilation systems provide acompiler driver that invokes th

Connection类之ConnectionDelegatesHandlers.cs(NetworkComms 2.3.1源码了解和学习)

networkComms.net2.3.1开源版本,基于gpl V3协议.因为不能公开3.x版本的源码,所以基于此版本进行学习.3.X版本进行了诸多改进和Bug修复,使用方法上两者相差不大. namespace NetworkCommsDotNet { /// <summary> /// Connection对象 这个类是TcpConnection和 UDPConnnection连接类的父类 /// Connection由以下五个文件组成 大家注意到每个类前面都有个 partial关键字 //