Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
J
jfxmap_python
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
oscar
jfxmap_python
Commits
322f0633
Commit
322f0633
authored
Jan 29, 2022
by
oscar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交新的空点云信息和老json文件到新json文件的转换
parent
2b8e05d9
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
53 additions
and
0 deletions
+53
-0
1643382558.269902000.pcd
script/generate/N2_1/1643382558.269902000.pcd
+0
-0
1629761335.371868000.pcd
script/generate/N2_3/1629761335.371868000.pcd
+0
-0
1643384039.212568000.pcd
script/generate/N3_1/1643384039.212568000.pcd
+0
-0
1643384425.814172000.pcd
script/generate/N3_2/1643384425.814172000.pcd
+0
-0
1628563464.551650000.pcd
script/generate/N5_1/1628563464.551650000.pcd
+0
-0
1643385027.128334000.pcd
script/generate/N7_1/1643385027.128334000.pcd
+0
-0
old_json_to_new_json.py
script/old_json_to_new_json.py
+53
-0
No files found.
script/generate/N2_1/1643382558.269902000.pcd
0 → 100644
View file @
322f0633
File added
script/generate/N2_3/1629761335.371868000.pcd
0 → 100644
View file @
322f0633
File added
script/generate/N3_1/1643384039.212568000.pcd
0 → 100644
View file @
322f0633
File added
script/generate/N3_2/1643384425.814172000.pcd
0 → 100644
View file @
322f0633
File added
script/generate/N5_1/1628563464.551650000.pcd
0 → 100644
View file @
322f0633
File added
script/generate/N7_1/1643385027.128334000.pcd
0 → 100644
View file @
322f0633
File added
script/old_json_to_new_json.py
0 → 100644
View file @
322f0633
import
os
import
json
import
glob
import
numpy
class
NumpyEncoder
(
json
.
JSONEncoder
):
def
default
(
self
,
obj
):
if
isinstance
(
obj
,
(
numpy
.
int_
,
numpy
.
intc
,
numpy
.
intp
,
numpy
.
int8
,
numpy
.
int16
,
numpy
.
int32
,
numpy
.
int64
,
numpy
.
uint8
,
numpy
.
uint16
,
numpy
.
uint32
,
numpy
.
uint64
)):
return
int
(
obj
)
elif
isinstance
(
obj
,
(
numpy
.
float_
,
numpy
.
float16
,
numpy
.
float32
,
numpy
.
float64
)):
return
float
(
obj
)
elif
isinstance
(
obj
,
(
numpy
.
ndarray
,)):
return
obj
.
tolist
()
return
json
.
JSONEncoder
.
default
(
self
,
obj
)
if
__name__
==
'__main__'
:
dir_name
=
"7_1"
old_json_path
=
"D:/shared/N7_1/jsons"
save_json_path
=
"D:/shared/N7_1/"
old_json_list
=
glob
.
glob
(
os
.
path
.
join
(
old_json_path
,
"*.json"
))
save_json
=
{}
save_json
[
"annotations"
]
=
[]
for
jsn_f
in
old_json_list
:
with
open
(
jsn_f
,
'r'
,
encoding
=
'utf-8'
,
errors
=
'ignore'
)
as
fp
:
jsn
=
json
.
load
(
fp
)
new_jsn
=
{}
new_jsn
[
"fileuri"
]
=
dir_name
+
"/pcd/"
+
jsn
[
"baseInfo"
][
"fileName"
]
new_jsn
[
"labels_box3D"
]
=
[]
for
old_info
in
jsn
[
"markResult"
][
"objects"
]:
new_info
=
{}
new_info
[
"box3D"
]
=
{}
new_info
[
"box3D"
][
"translation"
]
=
{
"x"
:
old_info
[
"center"
][
"x"
],
"y"
:
old_info
[
"center"
][
"y"
],
"z"
:
old_info
[
"center"
][
"z"
]}
new_info
[
"box3D"
][
"rotation"
]
=
{
"x"
:
old_info
[
"rotation"
][
"x"
],
"y"
:
old_info
[
"rotation"
][
"y"
],
"z"
:
old_info
[
"rotation"
][
"z"
],
"w"
:
old_info
[
"rotation"
][
"w"
]}
new_info
[
"box3D"
][
"size"
]
=
{
"x"
:
old_info
[
"dimensions"
][
"length"
],
"y"
:
old_info
[
"dimensions"
][
"width"
],
"z"
:
old_info
[
"dimensions"
][
"height"
]}
new_info
[
"category"
]
=
old_info
[
"content"
][
"label"
]
new_jsn
[
"labels_box3D"
]
.
append
(
new_info
)
save_json
[
"annotations"
]
.
append
(
new_jsn
)
save_json_name
=
save_json_path
+
"N"
+
dir_name
+
".json"
with
open
(
save_json_name
,
'w'
)
as
file_o
:
json
.
dump
(
save_json
,
file_o
,
cls
=
NumpyEncoder
,
indent
=
4
)
str
=
"10_1/pcd/1629734723.170913000.pcd"
print
(
str
.
split
(
'/'
))
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