Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
eos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Richard Torenvliet
eos
Commits
a217fb51
Commit
a217fb51
authored
Aug 01, 2015
by
patrikhuber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed texture_map to isomap
parent
2cedbf89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
include/eos/render/texture_extraction.hpp
include/eos/render/texture_extraction.hpp
+8
-8
No files found.
include/eos/render/texture_extraction.hpp
View file @
a217fb51
...
@@ -99,7 +99,7 @@ inline cv::Mat extract_texture(Mesh mesh, cv::Mat affine_camera_matrix, cv::Mat
...
@@ -99,7 +99,7 @@ inline cv::Mat extract_texture(Mesh mesh, cv::Mat affine_camera_matrix, cv::Mat
affine_camera_matrix
=
detail
::
calculate_affine_z_direction
(
affine_camera_matrix
);
affine_camera_matrix
=
detail
::
calculate_affine_z_direction
(
affine_camera_matrix
);
Mat
texture_
map
=
Mat
::
zeros
(
isomap_resolution
,
isomap_resolution
,
CV_8UC3
);
// #Todo: We do want an alpha channel. Will be added soon-ish.
Mat
iso
map
=
Mat
::
zeros
(
isomap_resolution
,
isomap_resolution
,
CV_8UC3
);
// #Todo: We do want an alpha channel. Will be added soon-ish.
// #Todo: We should handle gray images, but output a 3-channel isomap nevertheless I think.
// #Todo: We should handle gray images, but output a 3-channel isomap nevertheless I think.
for
(
const
auto
&
triangle_indices
:
mesh
.
tvi
)
{
for
(
const
auto
&
triangle_indices
:
mesh
.
tvi
)
{
...
@@ -139,9 +139,9 @@ inline cv::Mat extract_texture(Mesh mesh, cv::Mat affine_camera_matrix, cv::Mat
...
@@ -139,9 +139,9 @@ inline cv::Mat extract_texture(Mesh mesh, cv::Mat affine_camera_matrix, cv::Mat
res
=
Mat
(
affine_camera_matrix
*
Mat
(
vec
));
res
=
Mat
(
affine_camera_matrix
*
Mat
(
vec
));
src_tri
[
2
]
=
Vec2f
(
res
[
0
],
res
[
1
]);
src_tri
[
2
]
=
Vec2f
(
res
[
0
],
res
[
1
]);
dst_tri
[
0
]
=
cv
::
Point2f
(
texture_map
.
cols
*
mesh
.
texcoords
[
triangle_indices
[
0
]][
0
],
texture_
map
.
rows
*
mesh
.
texcoords
[
triangle_indices
[
0
]][
1
]
-
1.0
f
);
dst_tri
[
0
]
=
cv
::
Point2f
(
isomap
.
cols
*
mesh
.
texcoords
[
triangle_indices
[
0
]][
0
],
iso
map
.
rows
*
mesh
.
texcoords
[
triangle_indices
[
0
]][
1
]
-
1.0
f
);
dst_tri
[
1
]
=
cv
::
Point2f
(
texture_map
.
cols
*
mesh
.
texcoords
[
triangle_indices
[
1
]][
0
],
texture_
map
.
rows
*
mesh
.
texcoords
[
triangle_indices
[
1
]][
1
]
-
1.0
f
);
dst_tri
[
1
]
=
cv
::
Point2f
(
isomap
.
cols
*
mesh
.
texcoords
[
triangle_indices
[
1
]][
0
],
iso
map
.
rows
*
mesh
.
texcoords
[
triangle_indices
[
1
]][
1
]
-
1.0
f
);
dst_tri
[
2
]
=
cv
::
Point2f
(
texture_map
.
cols
*
mesh
.
texcoords
[
triangle_indices
[
2
]][
0
],
texture_
map
.
rows
*
mesh
.
texcoords
[
triangle_indices
[
2
]][
1
]
-
1.0
f
);
dst_tri
[
2
]
=
cv
::
Point2f
(
isomap
.
cols
*
mesh
.
texcoords
[
triangle_indices
[
2
]][
0
],
iso
map
.
rows
*
mesh
.
texcoords
[
triangle_indices
[
2
]][
1
]
-
1.0
f
);
// Get the inverse Affine Transform from original image: from dst to src
// Get the inverse Affine Transform from original image: from dst to src
Mat
warp_mat_org_inv
=
cv
::
getAffineTransform
(
dst_tri
,
src_tri
);
Mat
warp_mat_org_inv
=
cv
::
getAffineTransform
(
dst_tri
,
src_tri
);
...
@@ -195,7 +195,7 @@ inline cv::Mat extract_texture(Mesh mesh, cv::Mat affine_camera_matrix, cv::Mat
...
@@ -195,7 +195,7 @@ inline cv::Mat extract_texture(Mesh mesh, cv::Mat affine_camera_matrix, cv::Mat
color
=
image
.
at
<
cv
::
Vec3b
>
(
cvRound
(
src_texel
[
1
]),
cvRound
(
src_texel
[
0
]));
color
=
image
.
at
<
cv
::
Vec3b
>
(
cvRound
(
src_texel
[
1
]),
cvRound
(
src_texel
[
0
]));
}
}
}
}
texture_
map
.
at
<
cv
::
Vec3b
>
(
y
,
x
)
=
color
;
iso
map
.
at
<
cv
::
Vec3b
>
(
y
,
x
)
=
color
;
}
}
else
if
(
mapping_type
==
TextureInterpolation
::
Bilinear
)
{
else
if
(
mapping_type
==
TextureInterpolation
::
Bilinear
)
{
...
@@ -223,7 +223,7 @@ inline cv::Mat extract_texture(Mesh mesh, cv::Mat affine_camera_matrix, cv::Mat
...
@@ -223,7 +223,7 @@ inline cv::Mat extract_texture(Mesh mesh, cv::Mat affine_camera_matrix, cv::Mat
float
color_lower_left
=
image
.
at
<
cv
::
Vec3b
>
(
ceil
(
src_texel
[
1
]),
floor
(
src_texel
[
0
]))[
color
]
*
distance_lower_left
;
float
color_lower_left
=
image
.
at
<
cv
::
Vec3b
>
(
ceil
(
src_texel
[
1
]),
floor
(
src_texel
[
0
]))[
color
]
*
distance_lower_left
;
float
color_lower_right
=
image
.
at
<
cv
::
Vec3b
>
(
ceil
(
src_texel
[
1
]),
ceil
(
src_texel
[
0
]))[
color
]
*
distance_lower_right
;
float
color_lower_right
=
image
.
at
<
cv
::
Vec3b
>
(
ceil
(
src_texel
[
1
]),
ceil
(
src_texel
[
0
]))[
color
]
*
distance_lower_right
;
texture_
map
.
at
<
cv
::
Vec3b
>
(
y
,
x
)[
color
]
=
color_upper_left
+
color_upper_right
+
color_lower_left
+
color_lower_right
;
iso
map
.
at
<
cv
::
Vec3b
>
(
y
,
x
)[
color
]
=
color_upper_left
+
color_upper_right
+
color_lower_left
+
color_lower_right
;
}
}
}
}
else
if
(
mapping_type
==
TextureInterpolation
::
NearestNeighbour
)
{
else
if
(
mapping_type
==
TextureInterpolation
::
NearestNeighbour
)
{
...
@@ -233,13 +233,13 @@ inline cv::Mat extract_texture(Mesh mesh, cv::Mat affine_camera_matrix, cv::Mat
...
@@ -233,13 +233,13 @@ inline cv::Mat extract_texture(Mesh mesh, cv::Mat affine_camera_matrix, cv::Mat
Vec2f
src_texel
=
Mat
(
warp_mat_org_inv
*
Mat
(
homogenous_dst_coord
));
Vec2f
src_texel
=
Mat
(
warp_mat_org_inv
*
Mat
(
homogenous_dst_coord
));
if
((
cvRound
(
src_texel
[
1
])
<
image
.
rows
)
&&
(
cvRound
(
src_texel
[
0
])
<
image
.
cols
))
if
((
cvRound
(
src_texel
[
1
])
<
image
.
rows
)
&&
(
cvRound
(
src_texel
[
0
])
<
image
.
cols
))
texture_
map
.
at
<
cv
::
Vec3b
>
(
y
,
x
)
=
image
.
at
<
cv
::
Vec3b
>
(
cvRound
(
src_texel
[
1
]),
cvRound
(
src_texel
[
0
]));
iso
map
.
at
<
cv
::
Vec3b
>
(
y
,
x
)
=
image
.
at
<
cv
::
Vec3b
>
(
cvRound
(
src_texel
[
1
]),
cvRound
(
src_texel
[
0
]));
}
}
}
}
}
}
}
}
}
}
return
texture_
map
;
return
iso
map
;
};
};
}
/* namespace render */
}
/* namespace render */
...
...
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