浏览: 日期:2020-02-16
目标:这是ENGN4528 / 6528的CLab-2。 本实验的目的是帮助您熟悉和练习中级计算机视觉算法:特征点检测,匹配,图像区域分割。 练习基于特征脸的技术来进行脸部表示,检测和识别。但是请注意,在下面给出的所有实验室任务描述中,我们默认使用Matlab作为首选语言。 但是,如果您更熟悉Python,则可以自由选择Python。 如果您以前从未使用过Matlab或Python,那么本练习将使您快速熟悉用于图像处理和计算机视觉的Matlab / Python的基本语言用法。
1.每个计算机实验室都有三周时间:会话A和会话B。 辅导员/实验室讲师将为这两节课提供基本的指导。
2.将根据您的实验室报告的整体质量来标记您的实验室。 该报告将在规定的时间之前上传到Wattle网站,该时间通常在您实验室的第3周的星期五晚上。
3.如果您不能在两个2小时的会议中完成所有任务,这是正常的-设计这些任务是为了要花费大约9个小时来完成所有任务,包括完成实验室报告。 这表明,在参加第三次实验课程(每个CLab的第2周)之前,您必须确保自己已接近80。
学术诚信您应遵守大学的学术诚信和Pla窃政策。 您可以在实验室和项目任务上与其他学生交谈/一起工作。 您可以共享想法,但不能共享代码,您应该提交自己的作品。 您的课程讲师保留根据发生的学术不诚实行为确定适当处罚的权利。 违反大学政策可能会导致严厉的处罚。
CLab-2 Tasks
1 Harris Corner Detector. (5 marks)
1.阅读并了解拐角检测代码“ harris.m”。
2.完成缺少的部分,将“ harris.m”重写为Matlab函数,并设计适当的函数签名(1)。
3.在第13行和解决方案的第20行(0.5)之后的每一行中注释。
4.在提供的四个测试图像(可以从Wattle下载)上测试此功能。 通过在输入图像上标记检测到的角来显示结果(使用圆形或十字形等)(每个图像0.5 ,,总计2)。
5.将您的结果与Matlab内置函数corner()(0.5)的结果进行比较,并讨论影响Harris拐角检测(1)性能的因素。
Listing 1: harris.m%%
% CLAB2 Task−1: Harris Corner Detector
% Your name (Your uniID)
%
sigma = 2; thresh = 0.01; % Parameters, add more if needed% Derivative masks
dx = [−1 0 1;−1 0 1; −1 0 1];
dy = dx'; % dx is the transpose matrix of dy
% compute x and y derivatives of image
Ix = conv2(bw,dx,'same');
Iy = conv2(bw,dy,'same');
g = fspecial('gaussian',max(1,fix(3*sigma)*2+1),sigma); Ix2 = conv2(Ix.^2,g,'same'); % x and x
Iy2 = conv2(Iy.^2,g,'same'); % y and y
Ixy = conv2(Ix.*Iy,g,'same'); % x and y
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Task: Compute the Harris Cornerness %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Task: Perform non−maximum suppression and
% thresholding, return the N corner points% as an Nx2 matrix of x and y coordinates
In your Lab Report, you need to list your complete source code with detailed comments and show corner detection results and their comparisons for each of the test images.
2 K-Means Clustering and Color Image Segmentation.
In this task, you are asked to implement your own K-means clustering algorithm for colour image segmentation, and test it on the following two images as shown in Fig.1. Please note that the PNG-type (Portable Network Graphics) images are in the 48-bit format, and you need to first convert them to 24-bit images.
1.实现自己的K均值函数my_kmeans()。输入是要处理的数据点和簇数,输出是几个点簇(可以将单元阵列用于簇)。确保K均值中的每个步骤正确无误,并注释关键代码片段(1.5 comment)。
2.将K-means函数应用于彩色图像分割。每个像素应表示为一个5D向量,该向量编码:(1)L ∗-颜色的明度; (2)a ∗-红色和绿色之间的颜色位置; (3)b ∗-黄色和蓝色之间的位置; (4)x,y-像素坐标。请比较使用不同数量的聚类(1)和(2)有无像素坐标(1)的分割结果。
3.标准的K均值算法对初始化敏感(例如,初始集群中心/种子)。一种可能的解决方案是使用K-means ++,在该方法中,将初始种子强制彼此远离(以避免局部最小)。请阅读材料http://ilpubs.stanford.edu:8090/ 778/1 / 2006-13.pdf,总结报告中的关键步骤(0.5),然后在您的标准算法中将K-means ++实现为新的初始化策略(0.5)。使用不同数量的聚类和上一个问题(0.5)的相同5-D点表示,比较此新策略与标准K均值的图像分割性能(例如,收敛速度和分割结果)。
3 Face Recognition using Eigenface. (10 marks)
In this task, you are given the Yale face image dataset Yale−FaceA.zip. The dataset contains a training_set of totally 135 face images captured from 15 individuals (9 im-ages from each individual). You are also given 10 test images in the Test_set directory.
1. Unzip the face images and get an idea what they look like. Then take 10 different
frontal face images of yourself, convert them to grayscale, and align and resize them to match the images in Yale-Face. Explain why alignment is necessary for Eigen-face(0.5).
Figure 1: Two images for K-means color image segmentation. Left: peppers.png; Right: mandm.png.2. Train an Eigen-face recognition system. Specifically, at a minimum your face recognition system should do the following:
(1) Read all the 135 training images from Yale-Face, represent each image as a single data point in a high dimensional space and collect all the data points into a big data matrix.
(2) Perform PCA on the data matrix (1), and display the mean face (1). Given the size of input image, direct eigen decomposition of covariance matrix would be slow. Read lecture notes and find a faster way to compute eigen values and vectors, explain the reason (1) and implement it in your code (1).
(3) Determine the top k principal components and visualize the top-k eigen-faces in your report (1). You can choose k=10 or k=15.
(4) For each of the 10 test images in Yale-Face, read in the image, determine its projection onto the basis spanned by the top k eigenfaces. Use this pro-jection for a nearest-neighbour search over all the 135 faces, and find out which three face images are the most similar. Show these top 3 faces next to the test image in your report (1.5). Report and analyze the recognition accuracy of your method (1).
(5) Read in one of your own frontal face images. Then run your face recognizer on this new image. Display the top 3 faces in the training folder that are most similar to your own face (1).
(6) Repeat the previous experiment by pre-adding the other 9 of your face im-ages into the training set (a total of 144 training images). Note that you should make sure that your test face image is different from those included in the training set. Display the top 3 faces that are the closest to your face (1).
Hints:
(1) A simple way to do alignment is to manually crop (and rotate if necessary) the face region, resize the face image to a standard shape, and make sure the facial landmarks
are aligned – e.g. centre of eyes, noses, mouths are roughly at the same positions in an image.
(2) In doing eigen-decomposition, always remember to subtract the mean face and, when reconstructing images based on the first k principal components, add the mean face back in at the end.
(3) You can use Matlab’s functions for matrix decomposition and inverse matrix (e.g., eigs(), svd(), inv()) to implement PCA. Other than these, you should not use Matlab’s built-in PCA or eigenface function if there is one.Lab Report RequirementClab-* Report
ENGN4528/6528name
UID
Master/Bachelor
dd/mm/yyyy
Lab Report Requirement
1 Files
Upload a single ZIP file by the due date. You must use the following file name: CLab-1/2/3-Report-Uxxxxxx.zip, replacing Uxxxxx with your uni-ID.
Your ZIP file must contain the following contents:
(a) A PDF of your Lab Report. The report generally contains sample results from all the Lab Tasks, along with necessary comments and descriptions, questions and answers. The key parts of your code can also be included in your report. For more detail. Please refer to the following Template and General Instructions for Lab Report on the next page.
(b) A file named “code” to include all your *.m files.
2 Lab Report
Kindly document different question under respective headings provided with the as-signment. For example:
Task-1: The Question
1. Your first question under this theme Documentation, observations, results, analysis etc.
2. Your second question under this theme Documentation, observations, results, analysis etc.
3. Your third question under this theme Documentation, observations, results, analysis etc.
2.1 General Formatting Instruction• Kindly use the same font single-spaced type for the entire document as much as possible, you may use the bold and italic version of the same font to highlight the important points. Few recommended fonts are Times New Roman, Times, which are quite widely used font to document projects and research papers. Too big or too small font sizes are not encouraged.
• Kindly, use appropriate font size for sections heading and its contents accord-ingly. For example, 14-15 point Times, boldface type for heading and 11-12 point single-spaced type for the content is one of the widely used font sizes for documenting research papers.
• Please number all your sections and subsections of the tasks as provided in the assignment.
• Please show the images mentioned in each task to make your answer more clear. Brief explanations on how you solve the problem are expected.
• Please give your own answer following the question guidelines.
• Handwriting draft is not permitted.2.2 Table, Figures and Plots
This is one of the important aspects of evaluating your report. The figures and the caption of the tables must be appropriately addressed. The figure should have an ap-propriate title if required. All the legends in the figure should be properly highlighted. The caption of the figure should explain your observation and understanding which may comprise of quantitative or qualitative evaluation to endorse your observation. Some of the widely used font to caption your figure, table and callouts are 10-11 point Roman type, 10-11 point Helvetica non-boldface type. Kindly, adjust the size of the figure in the document appropriately such that it is clearly visible and perfectly eligible to illus-trate your observation. We encourage you to look into the below example for reference. Note: You cannot insist we can zoom in or out to see tiny details on the graphs, plots, photographs, illustration, etc. Also, make sure the figures you include in your document is not a copyright image.Caption: Variation in the y-axis corresponding to the values in the x-axis and What does this mean, your observations?
For the tables, graphs and others as well, kindly document the purpose of the statisti-cal illustration which should include titles and proper labelling of the data and statistics.Please follow the requirements to write your own Lab report.