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
3ef06d9d
Commit
3ef06d9d
authored
5 years ago
by
gkj1g12
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
d8665867
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/volume_gen.m
+62
-0
62 additions, 0 deletions
Synthetic Image Generator/volume_gen.m
with
62 additions
and
0 deletions
Synthetic Image Generator/volume_gen.m
0 → 100644
+
62
−
0
View file @
3ef06d9d
function
[
ini
,
Cam1
]
=
volume_gen
(
sizex
,
sizey
,
sizez
,
numP
,
Transform
,
Calib_type
)
% This function generates a volume sizex x sizey x sizez with number of
% particles specified by numP.
%
% INPUT VARIABLES:
% sizex = size of volume in the spanwise direction
% sizey = size of volume in the wall-normal direction
% sizez = size of volume in the streamwise direction
% numP = total number of particles in the volume
% Transform = structure which contains left and right camera transformation from projection matrix
% Calib_type = Type of calibration whether 3rd order polynomial or Camera pinhole model
%
% OUTPUT VARIABLES:
% ini = Initial coordinates of particles in object plane
% Cam1 = Corresponding coordinates of particles in image plane of camera
%
%--------------------------------------------------------------------------
%
% Version 1.0
% Girish K. Jankee (28 January 2018)
%--------------------------------------------------------------------------
%% Generate random coordinates of the particles
ini
.
X1
=
sizex
.*
rand
(
numP
,
1
)
-
sizex
.
/
2
;
ini
.
Y1
=
sizey
.*
rand
(
numP
,
1
);
ini
.
Z1
=
sizez
.*
rand
(
numP
,
1
)
-
sizez
.
/
2
;
if
Calib_type
==
1
% Apply the transformation matrix to the generated points
% Left camera
[
Cam1
.
L
.
X2
,
Cam1
.
L
.
Y2
]
=
apply_poly
(
ini
,
Transform
.
Leftcam
);
% Right camera
[
Cam1
.
R
.
X2
,
Cam1
.
R
.
Y2
]
=
apply_poly
(
ini
,
Transform
.
Rightcam
);
else
% Count rows and columns in the original image
[
num_rows
,
num_cols
,
depth
]
=
size
(
ini
.
X1
);
% Apply the transformation matrix to the shifted points
% Left camera
Trans
.
Left
=
Transform
.
Leftcam
*
[(
ini
.
X1
(:))
'; (ini.Y1(:))'
;
(
ini
.
Z1
(:))
'
;
ones
(
1
,
numel
(
ini
.
X1
))];
% Right camera
Trans
.
Right
=
Transform
.
Rightcam
*
[(
ini
.
X1
(:))
'; (ini.Y1(:))'
;
(
ini
.
Z1
(:))
'
;
ones
(
1
,
numel
(
ini
.
X1
))];
% Find the scaling factor
Lambda
.
L
=
reshape
(
Trans
.
Left
(
3
,
:),[
num_rows
,
num_cols
,
depth
]);
Lambda
.
R
=
reshape
(
Trans
.
Right
(
3
,
:),[
num_rows
,
num_cols
,
depth
]);
% Compute corresponding coordinates in image plane
% X-coordinate
Cam1
.
L
.
X2
=
reshape
(
Trans
.
Left
(
1
,
:),[
num_rows
,
num_cols
,
depth
])
.
/
Lambda
.
L
;
Cam1
.
R
.
X2
=
reshape
(
Trans
.
Right
(
1
,
:),[
num_rows
,
num_cols
,
depth
])
.
/
Lambda
.
R
;
% Y coordinate
Cam1
.
L
.
Y2
=
reshape
(
Trans
.
Left
(
2
,
:),[
num_rows
,
num_cols
,
depth
])
.
/
Lambda
.
L
;
Cam1
.
R
.
Y2
=
reshape
(
Trans
.
Right
(
2
,
:),[
num_rows
,
num_cols
,
depth
])
.
/
Lambda
.
R
;
end
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