Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Pope
ftl
Commits
856986fb
Commit
856986fb
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Add flip to SDK image write
parent
dbc7bd9e
No related branches found
No related tags found
No related merge requests found
Pipeline
#23018
passed
5 years ago
Stage: all
Stage: deploy
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
SDK/C/src/streams.cpp
+1
-0
1 addition, 0 deletions
SDK/C/src/streams.cpp
SDK/Python/blender_script.py
+22
-1
22 additions, 1 deletion
SDK/Python/blender_script.py
with
23 additions
and
1 deletion
SDK/C/src/streams.cpp
+
1
−
0
View file @
856986fb
...
@@ -137,6 +137,7 @@ ftlError_t ftlImageWrite(
...
@@ -137,6 +137,7 @@ ftlError_t ftlImageWrite(
}
}
if
(
tmp2
.
empty
())
return
FTLERROR_STREAM_NO_DATA
;
if
(
tmp2
.
empty
())
return
FTLERROR_STREAM_NO_DATA
;
cv
::
flip
(
tmp2
,
tmp2
,
0
);
// Flip to get opencv form.
img
.
upload
(
tmp2
);
img
.
upload
(
tmp2
);
ftl
::
codecs
::
Channels
<
0
>
channels
;
ftl
::
codecs
::
Channels
<
0
>
channels
;
...
...
This diff is collapsed.
Click to expand it.
SDK/Python/blender_script.py
+
22
−
1
View file @
856986fb
...
@@ -8,6 +8,15 @@ Camera = namedtuple("Camera", ["fx", "fy", "cx", "cy", "width", "height",
...
@@ -8,6 +8,15 @@ Camera = namedtuple("Camera", ["fx", "fy", "cx", "cy", "width", "height",
_d_max
=
65504.0
_d_max
=
65504.0
def
lin2s
(
x
):
a
=
0.055
if
x
<=
0.0031308
:
y
=
x
*
12.92
elif
0.0031308
<
x
<=
1
:
y
=
1.055
*
(
x
**
(
1.0
/
2.4
))
-
0.055
return
y
################################################################################
################################################################################
# https://blender.stackexchange.com/a/120063
# https://blender.stackexchange.com/a/120063
...
@@ -183,7 +192,19 @@ def render():
...
@@ -183,7 +192,19 @@ def render():
bpy
.
ops
.
render
.
render
()
bpy
.
ops
.
render
.
render
()
pixels
=
bpy
.
data
.
images
[
'
Viewer Node
'
]
pixels
=
bpy
.
data
.
images
[
'
Viewer Node
'
]
im
=
np
.
array
(
pixels
.
pixels
[:]).
reshape
((
pixels
.
size
[
1
],
pixels
.
size
[
0
],
pixels
.
channels
))
pix
=
np
.
array
(
pixels
.
pixels
[:])
# sRGB conversion
pix2
=
np
.
zeros
(
pix
.
shape
[:],
dtype
=
np
.
float
)
np
.
copyto
(
pix2
,
1.055
*
(
pix
**
(
1.0
/
2.4
))
-
0.055
,
where
=
pix
<=
1
)
np
.
copyto
(
pix2
,
pix
*
12.92
,
where
=
pix
<=
0.0031308
)
# Clamp?
pix2
[
pix2
>
1.0
]
=
1.0
im
=
pix2
.
reshape
((
pixels
.
size
[
1
],
pixels
.
size
[
0
],
pixels
.
channels
))
depthim
=
(
np
.
array
(
pixels
.
pixels
[:]).
reshape
((
pixels
.
size
[
1
],
pixels
.
size
[
0
],
pixels
.
channels
))[:,:,
3
]).
astype
(
np
.
float32
)
depthim
=
(
np
.
array
(
pixels
.
pixels
[:]).
reshape
((
pixels
.
size
[
1
],
pixels
.
size
[
0
],
pixels
.
channels
))[:,:,
3
]).
astype
(
np
.
float32
)
# set invalid depth values to 0.0
# set invalid depth values to 0.0
depthim
[
depthim
>=
_d_max
]
=
0.0
depthim
[
depthim
>=
_d_max
]
=
0.0
...
...
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