-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfsFitting.m
36 lines (26 loc) · 1.1 KB
/
fsFitting.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
% Demo: Fit points with Fourier Serise.
% Author: Jiaheng Zhao
clc;
clear all;
close all;
%load data: ori_points;
load(fullfile(pwd,filesep,'Data',filesep,'demo_fsFitting.mat'));
f1 = figure;
axis([-5 5 -5 5])
axis equal
% feature's shape -- groundtruth
pt1 = plot(ori_points(1,:),ori_points(2,:),'k');
hold on;
% sample some points for fitting.
smpID = 100 : 5 : 200; % What will it look like if changing smpID? Try.
pt2 = plot(ori_points(1,smpID),ori_points(2,smpID),'bo','MarkerSize',12);
% Number of the coefficient.
N = 5; % It should be less than the size of smpID.
isComplement = true; % set to true if the observed points are not sufficient. For example, smpID = 5:20:200
%% -------------------- This is the function you need to complete --------------------------%
[V, center, newpt] = fitWithFS( N, ori_points(1,smpID), ori_points(2,smpID), [], isComplement);
%% -----------------------------------------------------------------------------------------------%
% Plot
pt3 = plot(newpt(1,:),newpt(2,:),'r*','MarkerSize',12);
fs1 = plotFS(center,V,'r');
pct = plot(center(1),center(2),'rp','MarkerSize',12);