Matlab Programming Assignment Help

In this illustration we have applied PCA.The concept is to convert the data energy to another bases so that orthogonal decomposition is viable. We have also applied technique for removal of noise. Matlab Programming Assignment Help for this Principal Component Analysis also looks into the limitations like delay and the causes for it.

Principal Component Analysis

We are given 4 sets of recordings from 3 cameras positioned at different locations and orientations. The idea is to use the multitude of 2D recordings matlab programming assignment help to capture the behavior of an object in 3D.

The initial part of the assignment is to extract the center of mass of the object and map its movement projected in a 2D plane of the camera sensor. The object is extracted using computer vision methods and the movement is changed into a series of numerical values for each coordinate. In all 4 cases the main movement is in one axis only (vertical axis in our realistic set of bases, but depending on the camera orientation that changes, and for the feature help with matlab programming assignment space it doesn’t really matter – this is the benefit of the method used), but in the second case we add the camera shake to represent measurement noise, in the third case we add movement in other dimensions, and in the last case we add rotation.

After extracting spatial coordinates of each recording, for each case we can form feature space consisting of 6 vectors (3 cameras with two dimensions – 3X2 = 6). We then apply the method called Principal component Analysis (PCA) that first transforms the data set to another set of bases more appropriate for decomposition. After that, it gives us the energy of data distribution across different axes, enabling us to use a few essential components to capture the movement in total. Taking only one or a few most important components might reveal something about the nature of movement that is not obvious because of the noise or an awkward positioning of cameras. The PCA method can integrate the camera recordings without explicit knowledge on the camera positions, which is not something our eyes and brain can’t do on their own in many cases.

The camera recordings are presented in matlab programming project help the matrix form, so their processing is no different than usual work with matrices in MATLAB. Even so, dealing with large 4-dimensional matrices (two dimensional images in three colors and a number of frames) can easily cause problems with memory. The movie data is processed to transform them into very small vectors of center of mass estimated locations and saved as .mat files to enable easy reproduction of results if necessary.

Theoretical background

Each matrix represents a linear transformation performed on a vector or another matrix of appropriate dimensions. This transformation shifts the unity circle, rotates it and scales its orthonormal axes in a certain way. In general, this produces a hyperellipse, which means that data that is regularly distributed with no preference towards an axis suddenly becomes distributed along some axes more widely than along others – we can generally say that it has a wider variance. Since high variance also carries high information, working along those new axes is very beneficial, and if this effect is pronounced, we can completely eliminate some axes without significant matlab programming assignment solution impairment to the data set. By performing a singular value decomposition of a matrix, we obtain three matrices V, and U which are respectively initial set of bases, lengths of principal semiaxes of the new data set and the new set of bases:

1

Figure – Illustration of singular value decomposition

By comparing the singular values of the matrix we can decide which components carry most information and extract only those components. This also makes the data provided independent of the reference frame it was initially captured in and provides us with a unique data frame which is guaranteed to exist and provides optimal decomposition. The percentage of energy in each principal component is given by the ratio of that particular singular value to the sum of all singular values. If the sum of energies of only a portion of the components nears 100% up to a desired accuracy or defined by another requirement, the PCA method is meaningful and it should yield good results.

There are a few conditions for a successful do my matlab programming assignment decomposition and PCA. The problem must be linear as the whole method is based on linear algebra. This condition is very often fulfilled, and if that is not the case perhaps some sort of linearization around the working point can solve it. Also, the problem must be setup in such a way that it can be decomposed in the frame of reference we are using. The example of the inability to decompose rotation with a single degree of freedom into a one degree of freedom translational case is given in the notes.

Algorithm implementation and development

In the first part of the code we deal with extraction of feature data from the movie of the object in motion, and in the second part we perform the PCA method to extract the nature of the object’s movement.

In order to perform correct detection of movement, we need matlab programming assignment help to perform recognition and segmentation of the moving object using the image processing toolbox:

There are quite a few ways to extract the movement of the bucket object. There is a clearly visible patch of yellow paint on it which could be used for recognition, although this isn’t straightforward for the sole reason that RGB system has no yellow, so a conversion to CMYK system or another relatively complicated approach might be necessary. There is a help with matlab programming assignment small patch of red above the yellow that can be used but only after zooming in on the bucket as the human skin contains a lot of red that would alter the detection process. Another approach might be simply converting to greyscale and thresholding the image with a very high value close to 1 to extract the white marker above the bucket or a bucket as a whole. Zooming is necessary again because of the white patch in the top left or the shoe tip below.

After image binarization (thresholding with a very high value), we can use advanced computer vision functions in MATLAB to extract the movement of the object. Position is best represented by the position of the centroid for the black and white object:

2

Figure – Binarized image showing the bucket; the image was converted to grayscale and thresholded after zooming in

There are a number of things that can go matlab programming assignment help wrong with such a primitive detection. The exact shape of the contour changes in each frame even though the object doesn’t because of the subtle changes in illumination – this is unavoidable, but it doesn’t impair the detection significantly. Occasionally lone white pixels appear around the image and since they are potentially far away they can alter the centroid position significantly, and we solve them by opening the image with a relatively small element. Finally, constant patches of other detected surfaces are solved by zooming in around the object – this part is not automatic in any way.

clear all
close all
clc
X=zeros(600,6);
for h=1:4
X=zeros(300,6);
for i=1:3
load(['path',num2str(i),'_',num2str(h)])
%in first case we can correct the 9 sample delay
if i==2&&h==1
path(1:10,:)=[];
end
l(i)=length(path);
X(1:l(i),2*i-1:2*i)=path;
end

After the extraction of 2D coordinates for the centroid movement, the code for PCA is run. The implementation was directly taken from the lecture notes, apart from the initial part where the path vectors and loaded, pre-processed and help with matlab programming assignment shaped into a matrix convenient for PCA method.

Computational results

We decompose each case into three principal matlab programming assignment help components out of the available six that would correspond to the three dimensions in our space, as that approach has physical meaning for us. We begin with the “ideal” case with only vertical movement:

333Save

Save

3

First case without noise, but with slight delay

The expected result is obtaining one significant components that captures most of the dynamics of the object’s movement, but the results matlab programming project help prove us wrong, and we obtain two equally strong components. Since this result points us to a circular movement in a plane (and that is not the case), we explore the data set and see that there is a slight delay of around 10 frames in the second recording.

X(min(l)+1:end,:)=[];
X=X';
[m,n]=size(X); % compute data size
mn=mean(X,2); % compute mean for each row
X=X-repmat(mn,1,n); % subtract mean
[u,s,v]=svd(X/sqrt(n-1)); % perform the SVD
lambda=diag(s).^2; % produce diagonal variances
Y=u'*X; % produce the principal components projection
figure('Name',['Case ',num2str(h)])
subplot(3,1,1)
plot(Y(1,:))
title('Strongest component')
subplot(3,1,2)
plot(Y(2,:))
title('Second component')
subplot(3,1,3)
plot(Y(3,:))
title('Third component')

This delay creates an illusion of circular movement, indeed, if two cosine movements are in phase their dependence is linear and it can be fully matlab programming assignment help captured by one axis; if they are out of phase, the resulting dependence is not linear but represents an ellipse that needs two components to capture. By removing ten samples from the second camera we get the corrected result:

4

First case without noise with the delay removed

After seeing that PCA method can correctly capture the harmonic oscillation movement of the bucket, we try the noisy case:

5

PCA of shaking cameras to simulate noisy acquisition

The oscillatory movement is still captured in the matlab programming assignment help first component, but the noise has left consequences on the data – the movement seems somewhat distorted, and there is much more energy in the other components (which is only natural, as their truly is more data in those components now). It is interesting to note that spikes in other components match the degradation of the first component.

Looking at the third and fourth case (3D movement and rotation respectively):

6

PCA of 3D movement – combinations of different movements in all axes

7

PCA of vertical movement with rotation

We can see that the third case is matlab programming assignment solution decomposed correctly and shows oscillatory movement in all the dimensions, but rotation gives an unusual result. We have no dimension that would reflect rotation on its own, but in addition to the vertical movement in the first component, we see smaller do my matlab programming assignment oscillations in the second component and a damped oscillation pattern in the third component.

Summary and conclusions

First we note that PCA is a very useful method for capturing unknown movement dynamics in the first case, and moderately successful matlab programming assignment help at removing the noise in the second case. It is very important to help with matlab programming assignment note how different the results were before and after removing the delay, which shows great sensitivity to such a trivial problem, so timestamps matlab programming assignment help must be included for cases like this one. It must be noted that this is not the method shortcoming as out of sinc movement would physically mean a different type of movement, so this is purely an acquisition error.

The third case shows us that 3D decomposition matlab programming assignment help works very well and we have three-dimensional movement even though we have no information of the positioning of the camera. The inherent nature of the matlab programming project help method captures orthonormal components which are physically space coordinates.

The rotation case requires some discussion. First of all, the premise of our image processing detection assumes translational movement. If the object was completely monochromatic and uniform we would not be able to see the rotation at all, either with our eyes or the image processing software. The fact that some parts of the object appear and disappear to a different side additionally confuses the simple detection method. Apart from the first component matlab programming assignment solution which is correctly captured (no reason not to be), the other two components are misleading – there is no movement in any of the horizontal plane axes (although individual points do move in it), and there is definitely no movement that would matlab programming assignment help correspond to the damped oscillation. Not only is the detection unprepared for this case, but the rotation of the bucket is not a linear transform in the reference of XYZ system, so there is no way to capture it correctly by the PCA method. Even so, the output is different than all do my matlab programming assignment the others so we might be able to “recognize” rotation from the results.