Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
deepinfer
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yangxue
deepinfer
Commits
e1c4cc77
Commit
e1c4cc77
authored
Jul 19, 2023
by
xin.wang.waytous
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
undistort-revise
parent
3f82a7fa
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
19 deletions
+29
-19
multi_yolov5.yaml
configs/tasks/multi/multi_yolov5.yaml
+3
-6
rgb_intrinsic.yaml
configs/tasks/multi/rgb_intrinsic.yaml
+9
-0
undistort.cpp
src/libs/preprocessors/undistort.cpp
+17
-13
multi_res.jpg
test/multi_res.jpg
+0
-0
No files found.
configs/tasks/multi/multi_yolov5.yaml
View file @
e1c4cc77
...
...
@@ -12,11 +12,8 @@ units:
name
:
Undistort
inputNames
:
[
uint8Image
]
outputNames
:
[
undistortVisImage
]
imageWidth
:
1280
imageHeight
:
720
# new_camera_matrix: [1, 0, 1,
# 0, 1, 1,
# 0, 0, 1]
imageWidth
:
960
imageHeight
:
540
IntrinsicPath
:
configs/tasks/multi/rgb_intrinsic.yaml
-
name
:
ResizeNorm
...
...
@@ -45,7 +42,7 @@ units:
maxBatchSize
:
1
# used when build engine
-
name
:
MultiPostProcess
inputNames
:
[
detections
,
seg_protos
,
depths
,
semantics
,
u
int8
Image
]
inputNames
:
[
detections
,
seg_protos
,
depths
,
semantics
,
u
ndistortVis
Image
]
outputNames
:
[
out_instances
,
out_semantics
,
out_depths
]
inputWidth
:
640
inputHeight
:
640
...
...
configs/tasks/multi/rgb_intrinsic.yaml
View file @
e1c4cc77
...
...
@@ -20,3 +20,12 @@ distortion_coefficients:
-55.27210998535156
,
417.6490173339844
]
new_image_width
:
960
new_image_height
:
540
new_camera_matrix
:
rows
:
3
cols
:
3
dt
:
d
data
:
[
779.9261475
,
0.
,
478.369263
,
0.
,
779.9261475
,
275.66448975
,
0.
,
0.
,
1.
]
src/libs/preprocessors/undistort.cpp
View file @
e1c4cc77
...
...
@@ -20,18 +20,6 @@ bool Undistort::Init(YAML::Node& node) {
LOG_WARN
<<
"Load intrinsic error: "
<<
IntrinsicPath
;
return
false
;
}
if
(
node
[
"new_camera_matrix"
].
IsDefined
()
&&
!
node
[
"new_camera_matrix"
].
IsNull
()){
for
(
int
i
=
0
;
i
<
9
;
i
++
){
new_camera_intrinsic
(
i
)
=
node
[
"new_camera_matrix"
][
i
].
as
<
float
>
();
}
}
else
{
new_camera_intrinsic
=
camera_intrinsic
;
if
(
dst_height_
!=
src_height_
||
dst_width_
!=
src_width_
){
LOG_INFO
<<
"use same camera intrinsic to undistort image, but with different img_size. use the same size"
;
dst_height_
=
src_height_
;
dst_width_
=
src_width_
;
}
}
d_mapx_
.
Reshape
({
dst_height_
,
dst_width_
});
d_mapy_
.
Reshape
({
dst_height_
,
dst_width_
});
...
...
@@ -41,7 +29,7 @@ bool Undistort::Init(YAML::Node& node) {
InitUndistortRectifyMap
(
camera_intrinsic
,
distortion_coefficients
,
I
,
camera_intrinsic
,
dst_width_
,
new_
camera_intrinsic
,
dst_width_
,
dst_height_
,
&
d_mapx_
,
&
d_mapy_
);
dst_img
=
std
::
make_shared
<
base
::
Image8U
>
(
dst_height_
,
dst_width_
,
base
::
Color
::
BGR
);
...
...
@@ -79,6 +67,22 @@ bool Undistort::loadIntrinsic(std::string& yaml_file){
distortion_coefficients
(
i
)
=
0
;
}
}
if
(
node
[
"new_camera_matrix"
].
IsDefined
()
&&
!
node
[
"new_camera_matrix"
].
IsNull
()){
for
(
int
i
=
0
;
i
<
9
;
i
++
){
new_camera_intrinsic
(
i
)
=
node
[
"new_camera_matrix"
][
"data"
][
i
].
as
<
float
>
();
}
dst_width_
=
node
[
"new_image_width"
].
as
<
int
>
();
dst_height_
=
node
[
"new_image_height"
].
as
<
int
>
();
}
else
{
new_camera_intrinsic
=
camera_intrinsic
;
if
(
dst_height_
!=
src_height_
||
dst_width_
!=
src_width_
){
LOG_INFO
<<
"use same camera intrinsic to undistort image, but with different img_size. use the same size"
;
dst_height_
=
src_height_
;
dst_width_
=
src_width_
;
}
}
if
(
node
[
"rectification_matrix"
].
IsDefined
()
&&
node
[
"rectification_matrix"
][
"data"
].
IsDefined
()
&&
!
node
[
"rectification_matrix"
][
"data"
].
IsNull
()
){
...
...
test/multi_res.jpg
View replaced file @
3f82a7fa
View file @
e1c4cc77
365 KB
|
W:
|
H:
241 KB
|
W:
|
H:
2-up
Swipe
Onion skin
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