Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
2
2D-3C PIV tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bgroup
2D-3C PIV tools
Commits
f02f9e5a
Commit
f02f9e5a
authored
5 years ago
by
gkj1g12
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
1aa0904e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Synthetic Image Generator/poly_fit.m
+42
-0
42 additions, 0 deletions
Synthetic Image Generator/poly_fit.m
with
42 additions
and
0 deletions
Synthetic Image Generator/poly_fit.m
0 → 100644
+
42
−
0
View file @
f02f9e5a
function
[
calib_X
,
calib_Y
,
model
]
=
poly_fit
(
Coord
)
% This function opens a coordinates file for a camera, obtained from the
% function retrieve_marker_coord.m and computes a polynomial between
% image plane coordinates [in pixels] and object plane coordinates [in mm].
% The coefficients of the polynomial are then returned in 2 matrices corresponding
% to X and Y for the camera.
% The polynomial is 3rd order in x and y direction and linear in z
% direction
%
% 3rd order polynomial is in the form:
% x3 + y3 + x2 + y2 + x + y + x2y + xy2 + xy + z + constant
% Coefficients are given in the same order
%
% INPUT VARIABLES:
% Coord = Image and object plane coordinates for the camera
%
% OUTPUT VARIABLES:
% calib_X = Polynomial properties for X coord
% calib_Y = Polynomial properties for Y coord
%
%--------------------------------------------------------------------------
%
% Version 1.0
% Girish K. Jankee (28 January 2018)
%--------------------------------------------------------------------------
%% MAIN CODE
model
=
@
(
F
,
mat
)
F
(
1
)
.*
mat
(:,
1
)
.^
3
+
F
(
2
)
.*
(
mat
(:,
2
)
.^
3
)
+
F
(
3
)
.*
mat
(:,
1
)
.^
2
+
...
F
(
4
)
.*
mat
(:,
2
)
.^
2
+
F
(
5
)
.*
mat
(:,
1
)
+
F
(
6
)
.*
mat
(:,
2
)
+
F
(
7
)
.*
(
mat
(:,
1
)
.^
2
)
.*
mat
(:,
2
)
+
...
F
(
8
)
.*
mat
(:,
1
)
.*
(
mat
(:,
2
)
.^
2
)
+
F
(
9
)
.*
mat
(:,
1
)
.*
mat
(:,
2
)
+
F
(
10
)
.*
mat
(:,
3
)
+
F
(
11
);
% Model form of polynomial fit
% keyboard
ini
=
ones
(
1
,
11
);
% Initial conditions
X
=
zeros
(
1
,
11
);
Y
=
zeros
(
1
,
11
);
[
X
,
Rx
,
Jx
,
COVBx
,
MSEx
]
=
nlinfit
(
Coord
(:,
3
:
5
),
Coord
(:,
1
),
model
,
ini
);
% returns a vector of estimated coefficients for the nonlinear regression
[
Y
,
Ry
,
Jy
,
COVBy
,
MSEy
]
=
nlinfit
(
Coord
(:,
3
:
5
),
Coord
(:,
2
),
model
,
ini
);
% The coefficients are estimated using iterative least squares estimation
% disp(model(X,[0,0,100,0,0]))
% disp(std(Rx))
% disp(std(Ry))
calib_X
=
X
;
calib_Y
=
Y
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment