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
b8dc8fe8
Commit
b8dc8fe8
authored
Feb 27, 2020
by
gkj1g12
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
f02f9e5a
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/retrieve_marker_coord.m
+84
-0
84 additions, 0 deletions
Synthetic Image Generator/retrieve_marker_coord.m
with
84 additions
and
0 deletions
Synthetic Image Generator/retrieve_marker_coord.m
0 → 100644
+
84
−
0
View file @
b8dc8fe8
function
[
Coord
,
corners_cam
]
=
retrieve_marker_coord
(
calibname
)
% This function opens a DaVis 'MarkPositionTable.xml' file and retrieves the
% the position of markers. In raw image coordinate system (Image plane),
% [X,Y] coordinates are given in pixels while in the world coordinate system
% (Object plane), [x,y,z] coordinates are in mm. This is then returned in
% two matrices corresponding to each camera. This script uses 'xml2struct'.
% It must be searchable in the MATLAB path [Download link:
% https://uk.mathworks.com/matlabcentral/fileexchange/28518-xml2struct]
%
% INPUT VARIABLES:
% filename = pathname of xml file
%
% OUTPUT VARIABLES:
% Coord = Image and object plane coordinates for left and right camera
% Format: 1st column - image plane x coordinates [in pixels]
% 2nd column - image plane y coordinates [in pixels]
% 3rd column - object plane x coordinates [in mm]
% 4th column - object plane y coordinates [in mm]
% 5th column - objetc plane z coordinates [in mm]
% corners_cam = The pixels of the camera's corners
%
%--------------------------------------------------------------------------
% Version 1.0
% Girish K. Jankee (26 January 2018)
%
% Version 2.0
% Eduardo Rodriguez-Lopez (24 April 2018)
% Determination of distance between 2 z-planes is now automated.
%
% Version 2.1
% Girish K. Jankee (26 April 2018)
% Added feature extracts the coordinates of the camera's corners.
%--------------------------------------------------------------------------
%% MAIN CODE
a
=
xml2struct
(
calibname
);
for
i
=
1
:
2
if
i
==
1
cam_L
=
cell2mat
(
a
.
MarkTable
(
1
)
.
Camera
{
1
,
i
}
.
View
(
1
,
1
)
.
Mark
);
else
cam_R
=
cell2mat
(
a
.
MarkTable
(
1
)
.
Camera
{
1
,
i
}
.
View
(
1
,
1
)
.
Mark
);
end
end
% Left Camera
posL
=
zeros
(
length
(
cam_L
),
5
);
for
j
=
1
:
length
(
cam_L
)
posL
(
j
,
1
)
=
str2num
(
cam_L
(
j
)
.
RawPos
(
1
)
.
Attributes
(
1
)
.
x
);
posL
(
j
,
2
)
=
str2num
(
cam_L
(
j
)
.
RawPos
(
1
)
.
Attributes
(
1
)
.
y
);
posL
(
j
,
3
)
=
str2num
(
cam_L
(
j
)
.
WorldPos
(
1
)
.
Attributes
(
1
)
.
x
);
posL
(
j
,
4
)
=
str2num
(
cam_L
(
j
)
.
WorldPos
(
1
)
.
Attributes
(
1
)
.
y
);
posL
(
j
,
5
)
=
str2num
(
cam_L
(
j
)
.
WorldPos
(
1
)
.
Attributes
(
1
)
.
z
);
end
% keyboard
thickL
=
abs
(
mean
(
posL
(
posL
(:,
5
)
~=
0
,
5
)));
posL
(
abs
(
posL
(:,
5
)
+
thickL
)
<
1e-10
,
5
)
=
-
thickL
/
2
;
posL
(
abs
(
posL
(:,
5
)
-
0
)
<
1e-10
,
5
)
=
thickL
/
2
;
% Right Camera
posR
=
zeros
(
length
(
cam_R
),
5
);
for
j
=
1
:
length
(
cam_R
)
posR
(
j
,
1
)
=
str2num
(
cam_R
(
j
)
.
RawPos
(
1
)
.
Attributes
(
1
)
.
x
);
posR
(
j
,
2
)
=
str2num
(
cam_R
(
j
)
.
RawPos
(
1
)
.
Attributes
(
1
)
.
y
);
posR
(
j
,
3
)
=
str2num
(
cam_R
(
j
)
.
WorldPos
(
1
)
.
Attributes
(
1
)
.
x
);
posR
(
j
,
4
)
=
str2num
(
cam_R
(
j
)
.
WorldPos
(
1
)
.
Attributes
(
1
)
.
y
);
posR
(
j
,
5
)
=
str2num
(
cam_R
(
j
)
.
WorldPos
(
1
)
.
Attributes
(
1
)
.
z
);
end
thickR
=
abs
(
mean
(
posR
(
posR
(:,
5
)
~=
0
,
5
)));
posR
(
abs
(
posR
(:,
5
)
+
thickR
)
<
1e-10
,
5
)
=
-
thickR
/
2
;
posR
(
abs
(
posR
(:,
5
)
-
0
)
<
1e-10
,
5
)
=
thickR
/
2
;
if
thickR
~=
thickL
error
(
'thickness are not the same!!!'
)
end
Coord
.
Left
=
posL
;
Coord
.
Right
=
posR
;
height
=
str2num
(
a
.
MarkTable
(
1
)
.
Camera
{
1
,
1
}
.
Attributes
.
Height
);
width
=
str2num
(
a
.
MarkTable
(
1
)
.
Camera
{
1
,
1
}
.
Attributes
.
Width
);
corners_cam
=
[
0
width
width
0
0
0
height
height
];
% the pixels of the camera's corners
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