Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
44663a24
Commit
44663a24
authored
Nov 01, 2015
by
Wangyida
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify background images and a backward view
parent
b51d0df4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
17 deletions
+96
-17
README.md
modules/README.md
+1
-1
datagen_all.sh
modules/cnn_3dobj/samples/datagen_all.sh
+0
-0
datagen_back.sh
modules/cnn_3dobj/samples/datagen_back.sh
+46
-0
datagen_front.sh
modules/cnn_3dobj/samples/datagen_front.sh
+0
-0
demo_sphereview_data.cpp
modules/cnn_3dobj/samples/demo_sphereview_data.cpp
+49
-16
No files found.
modules/README.md
View file @
44663a24
...
...
@@ -47,7 +47,7 @@ $ cmake -D OPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules -D BUILD_opencv_re
19.
**opencv_xfeatures2d**
: Extra 2D Features Framework containing experimental and non-free 2D feature algorithms.
20.
**opencv_ximgproc**
: Extended Image Processing: Structured Forests / Domain Transform Filter / Guided Filter / Adaptive Manifold Filter / Joint Bilateral Filter / Superpixels.
21.
**opencv_xobjdetect**
: Integral Channel Features Detector Framework.
22.
**opencv_xphoto**
: Additional photo processing algorithms: Color balance / Denoising / Inpainting.
...
...
modules/cnn_3dobj/samples/datagen_all.sh
View file @
44663a24
This diff is collapsed.
Click to expand it.
modules/cnn_3dobj/samples/datagen_back.sh
0 → 100755
View file @
44663a24
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/aeroplane/01.ply
-label_class
=
1
-label_item
=
1
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/
-semisphere
=
0
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/aeroplane/02.ply
-label_class
=
1
-label_item
=
2
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/
-semisphere
=
0
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/aeroplane/03.ply
-label_class
=
1
-label_item
=
3
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/
-semisphere
=
0
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/aeroplane/04.ply
-label_class
=
1
-label_item
=
4
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/
-semisphere
=
0
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/aeroplane/05.ply
-label_class
=
1
-label_item
=
5
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/
-semisphere
=
0
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/aeroplane/06.ply
-label_class
=
1
-label_item
=
6
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/
-semisphere
=
0
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/aeroplane/07.ply
-label_class
=
1
-label_item
=
7
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/
-semisphere
=
0
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/aeroplane/08.ply
-label_class
=
1
-label_item
=
8
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/
-semisphere
=
0
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/bicycle/01.ply
-label_class
=
2
-label_item
=
1
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/
-z_range
=
0.6
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/bicycle/02.ply
-label_class
=
2
-label_item
=
2
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/
-z_range
=
0.6
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/bicycle/03.ply
-label_class
=
2
-label_item
=
3
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/
-z_range
=
0.6
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/bicycle/04.ply
-label_class
=
2
-label_item
=
4
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/
-z_range
=
0.6
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/bicycle/05.ply
-label_class
=
2
-label_item
=
5
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/
-z_range
=
0.6
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/bicycle/06.ply
-label_class
=
2
-label_item
=
6
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/
-z_range
=
0.6
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/boat/01.ply
-label_class
=
3
-label_item
=
1
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/
-z_range
=
0.6
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/boat/02.ply
-label_class
=
3
-label_item
=
2
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/
-z_range
=
0.6
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/boat/04.ply
-label_class
=
3
-label_item
=
4
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/
-z_range
=
0.6
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/boat/05.ply
-label_class
=
3
-label_item
=
5
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/
-z_range
=
0.6
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/boat/06.ply
-label_class
=
3
-label_item
=
6
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/
-z_range
=
0.6
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/bus/01.ply
-label_class
=
5
-label_item
=
1
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/
-z_range
=
0.2
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/bus/02.ply
-label_class
=
5
-label_item
=
2
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/
-z_range
=
0.2
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/bus/03.ply
-label_class
=
5
-label_item
=
3
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/
-z_range
=
0.2
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/bus/04.ply
-label_class
=
5
-label_item
=
4
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/
-z_range
=
0.2
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/bus/05.ply
-label_class
=
5
-label_item
=
5
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/
-z_range
=
0.2
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/bus/06.ply
-label_class
=
5
-label_item
=
6
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/
-z_range
=
0.2
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/car/01.ply
-label_class
=
6
-label_item
=
1
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/
-z_range
=
0.5
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/car/02.ply
-label_class
=
6
-label_item
=
2
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/
-z_range
=
0.5
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/car/03.ply
-label_class
=
6
-label_item
=
3
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/
-z_range
=
0.5
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/car/04.ply
-label_class
=
6
-label_item
=
4
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/
-z_range
=
0.5
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/car/05.ply
-label_class
=
6
-label_item
=
5
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/
-z_range
=
0.5
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/car/06.ply
-label_class
=
6
-label_item
=
6
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/
-z_range
=
0.5
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/car/07.ply
-label_class
=
6
-label_item
=
7
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/
-z_range
=
0.5
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/car/08.ply
-label_class
=
6
-label_item
=
8
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/
-z_range
=
0.5
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/car/09.ply
-label_class
=
6
-label_item
=
9
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/
-z_range
=
0.5
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/car/10.ply
-label_class
=
6
-label_item
=
10
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/
-z_range
=
0.5
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/motorbike/01.ply
-label_class
=
9
-label_item
=
1
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/motorbike_pascal/
-z_range
=
0.5
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/motorbike/02.ply
-label_class
=
9
-label_item
=
2
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/motorbike_pascal/
-z_range
=
0.5
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/motorbike/03.ply
-label_class
=
9
-label_item
=
3
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/motorbike_pascal/
-z_range
=
0.5
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/motorbike/04.ply
-label_class
=
9
-label_item
=
4
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/motorbike_pascal/
-z_range
=
0.5
-view_region
=
2
./sphereview_test
-plymodel
=
/Users/yidawang/Documents/database/PASCAL3D+_release1.1/CAD/motorbike/05.ply
-label_class
=
9
-label_item
=
5
-bakgrdir
=
/Users/yidawang/Documents/database/backgrd_pascal/motorbike_pascal/
-z_range
=
0.5
-view_region
=
2
\ No newline at end of file
modules/cnn_3dobj/samples/datagen_front.sh
View file @
44663a24
This diff is collapsed.
Click to expand it.
modules/cnn_3dobj/samples/demo_sphereview_data.cpp
View file @
44663a24
...
...
@@ -100,7 +100,7 @@ int main(int argc, char *argv[])
"{rgb_use | 0 | Use RGB image or grayscale. }"
"{num_class | 6 | Total number of classes of models. }"
"{binary_out | 0 | Produce binaryfiles for images and label. }"
"{
front_view | 0 | Take a special view of front
angle}"
;
"{
view_region | 0 | Take a special view of front or back
angle}"
;
/* Get parameters from comand line. */
cv
::
CommandLineParser
parser
(
argc
,
argv
,
keys
);
parser
.
about
(
"Generating training data for CNN with triplet loss"
);
...
...
@@ -126,56 +126,88 @@ int main(int argc, char *argv[])
int
rgb_use
=
parser
.
get
<
int
>
(
"rgb_use"
);
int
num_class
=
parser
.
get
<
int
>
(
"num_class"
);
int
binary_out
=
parser
.
get
<
int
>
(
"binary_out"
);
int
front_view
=
parser
.
get
<
int
>
(
"front_view
"
);
int
view_region
=
parser
.
get
<
int
>
(
"view_region
"
);
double
obj_dist
,
bg_dist
,
y_range
;
if
(
front_view
)
if
(
view_region
==
1
||
view_region
==
2
)
{
/* Set for TV */
if
(
label_class
==
12
)
obj_dist
=
340
;
else
obj_dist
=
2
4
0
;
obj_dist
=
2
5
0
;
ite_depth
=
ite_depth
+
1
;
bg_dist
=
700
;
y_range
=
0.85
;
}
else
else
if
(
view_region
==
0
)
{
obj_dist
=
370
;
bg_dist
=
400
;
}
if
(
label_class
==
5
|
label_class
==
10
|
label_class
==
11
|
label_class
==
12
)
ite_depth
=
ite_depth
+
1
;
cv
::
cnn_3dobj
::
icoSphere
ViewSphere
(
10
,
ite_depth
);
std
::
vector
<
cv
::
Point3d
>
campos
;
std
::
vector
<
cv
::
Point3d
>
campos_temp
=
ViewSphere
.
CameraPos
;
if
(
semisphere
)
/* Regular objects on the ground using a semisphere view system */
if
(
semisphere
==
1
)
{
if
(
front_view
)
if
(
view_region
==
1
)
{
for
(
int
pose
=
0
;
pose
<
static_cast
<
int
>
(
campos_temp
.
size
());
pose
++
)
{
if
(
campos_temp
.
at
(
pose
).
z
>=
0
&&
campos_temp
.
at
(
pose
).
z
<
z_range
&&
(
campos_temp
.
at
(
pose
).
y
<
-
y_range
||
campos_temp
.
at
(
pose
).
y
>
y_range
)
)
if
(
campos_temp
.
at
(
pose
).
z
>=
0
&&
campos_temp
.
at
(
pose
).
z
<
z_range
&&
campos_temp
.
at
(
pose
).
y
<
-
y_range
)
campos
.
push_back
(
campos_temp
.
at
(
pose
));
}
}
else
else
if
(
view_region
==
2
)
{
for
(
int
pose
=
0
;
pose
<
static_cast
<
int
>
(
campos_temp
.
size
());
pose
++
)
{
if
(
campos_temp
.
at
(
pose
).
z
>=
0
&&
campos_temp
.
at
(
pose
).
z
<
z_range
)
if
(
campos_temp
.
at
(
pose
).
z
>=
0
&&
campos_temp
.
at
(
pose
).
z
<
z_range
&&
campos_temp
.
at
(
pose
).
y
>
y_range
)
campos
.
push_back
(
campos_temp
.
at
(
pose
));
}
}
else
{
/* Set for sofa */
if
(
label_class
==
10
)
{
for
(
int
pose
=
0
;
pose
<
static_cast
<
int
>
(
campos_temp
.
size
());
pose
++
)
{
if
(
campos_temp
.
at
(
pose
).
z
>=
0
&&
campos_temp
.
at
(
pose
).
z
<
z_range
&&
campos_temp
.
at
(
pose
).
y
<
-
0.4
)
campos
.
push_back
(
campos_temp
.
at
(
pose
));
}
}
else
{
for
(
int
pose
=
0
;
pose
<
static_cast
<
int
>
(
campos_temp
.
size
());
pose
++
)
{
if
(
campos_temp
.
at
(
pose
).
z
>=
0
&&
campos_temp
.
at
(
pose
).
z
<
z_range
)
campos
.
push_back
(
campos_temp
.
at
(
pose
));
}
}
}
}
/* Special object such as plane using a full space of view sphere */
else
{
if
(
front_view
)
if
(
view_region
==
1
)
{
obj_dist
=
200
;
for
(
int
pose
=
0
;
pose
<
static_cast
<
int
>
(
campos_temp
.
size
());
pose
++
)
{
if
(
campos_temp
.
at
(
pose
).
z
<
0.2
&&
campos_temp
.
at
(
pose
).
z
>
-
0.2
&&
(
campos_temp
.
at
(
pose
).
y
<
-
y_range
||
campos_temp
.
at
(
pose
).
y
>
y_range
)
)
if
(
campos_temp
.
at
(
pose
).
z
<
0.2
&&
campos_temp
.
at
(
pose
).
z
>
-
0.2
&&
campos_temp
.
at
(
pose
).
y
<
-
y_range
)
campos
.
push_back
(
campos_temp
.
at
(
pose
));
}
}
else
if
(
view_region
==
2
)
{
for
(
int
pose
=
0
;
pose
<
static_cast
<
int
>
(
campos_temp
.
size
());
pose
++
)
{
if
(
campos_temp
.
at
(
pose
).
z
<
0.2
&&
campos_temp
.
at
(
pose
).
z
>
-
0.2
&&
campos_temp
.
at
(
pose
).
y
>
y_range
)
campos
.
push_back
(
campos_temp
.
at
(
pose
));
}
}
else
{
for
(
int
pose
=
0
;
pose
<
static_cast
<
int
>
(
campos_temp
.
size
());
pose
++
)
...
...
@@ -251,9 +283,9 @@ int main(int argc, char *argv[])
imglabel
<<
filename
<<
' '
<<
label_class
<<
endl
;
filename
=
imagedir
+
filename
;
/* Get the pose of the camera using makeCameraPoses. */
if
(
front_view
)
if
(
view_region
!=
0
)
{
cam_focal_point
.
y
=
cam_focal_point
.
y
-
label_x
/
30
;
cam_focal_point
.
x
=
cam_focal_point
.
y
-
label_x
/
5
;
}
Affine3f
cam_pose
=
viz
::
makeCameraPose
(
campos
.
at
(
pose
)
*
obj_dist
+
cam_focal_point
,
cam_focal_point
,
cam_y_dir
*
obj_dist
+
cam_focal_point
);
/* Get the transformation matrix from camera coordinate system to global. */
...
...
@@ -276,7 +308,8 @@ int main(int argc, char *argv[])
if
(
bakgrdir
.
size
()
!=
0
)
{
cv
::
Mat
img_bg
=
cv
::
imread
(
name_bkg
.
at
(
rand
()
%
name_bkg
.
size
()));
cv
::
viz
::
WImage3D
background_widget
(
img_bg
,
Size2d
(
image_size
*
4
,
image_size
*
4
),
Vec3d
(
-
campos
.
at
(
pose
)
*
bg_dist
-
cam_focal_point
),
Vec3d
(
campos
.
at
(
pose
)
*
bg_dist
+
cam_focal_point
),
Vec3d
(
0
,
0
,
-
100
));
/* Back ground images has a distance of 2 times of radius of camera view distance */
cv
::
viz
::
WImage3D
background_widget
(
img_bg
,
Size2d
(
image_size
*
4.2
,
image_size
*
4.2
),
Vec3d
(
-
campos
.
at
(
pose
)
*
bg_dist
+
cam_focal_point
),
Vec3d
(
campos
.
at
(
pose
)
*
bg_dist
-
cam_focal_point
),
Vec3d
(
0
,
0
,
-
1
)
*
bg_dist
+
Vec3d
(
0
,
2
*
cam_focal_point
.
y
,
0
));
myWindow
.
showWidget
(
"bgwidget"
,
background_widget
,
cloud_pose_global
);
}
// mesh_widget.setRenderingProperty(viz::LINE_WIDTH, 4.0);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment