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
Admin message
Maintenance moved to Monday 17.3. at 13:00. ETA 60 - 90 minutes.
Show more breadcrumbs
Nicolas Pope
ftl
Commits
df49b853
Commit
df49b853
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Fixes for bad HDR conversion
parent
856986fb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#23019
passed
5 years ago
Stage: all
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
SDK/C/include/ftl/ftl.h
+2
-1
2 additions, 1 deletion
SDK/C/include/ftl/ftl.h
SDK/C/src/streams.cpp
+15
-6
15 additions, 6 deletions
SDK/C/src/streams.cpp
SDK/Python/blender_script.py
+6
-4
6 additions, 4 deletions
SDK/Python/blender_script.py
with
23 additions
and
11 deletions
SDK/C/include/ftl/ftl.h
+
2
−
1
View file @
df49b853
...
@@ -93,7 +93,8 @@ enum ftlImageFormat_t {
...
@@ -93,7 +93,8 @@ enum ftlImageFormat_t {
FTLIMAGE_BGRA
,
FTLIMAGE_BGRA
,
FTLIMAGE_RGBA
,
FTLIMAGE_RGBA
,
FTLIMAGE_RGB
,
FTLIMAGE_RGB
,
FTLIMAGE_BGR
FTLIMAGE_BGR
,
FTLIMAGE_RGB_FLOAT
// Used by Blender
};
};
#ifdef __cplusplus
#ifdef __cplusplus
...
...
This diff is collapsed.
Click to expand it.
SDK/C/src/streams.cpp
+
15
−
6
View file @
df49b853
...
@@ -133,9 +133,17 @@ ftlError_t ftlImageWrite(
...
@@ -133,9 +133,17 @@ ftlError_t ftlImageWrite(
case
FTLIMAGE_RGB
:
tmp
=
cv
::
Mat
(
intrin
.
height
,
intrin
.
width
,
CV_8UC3
,
const_cast
<
void
*>
(
data
),
pitch
);
case
FTLIMAGE_RGB
:
tmp
=
cv
::
Mat
(
intrin
.
height
,
intrin
.
width
,
CV_8UC3
,
const_cast
<
void
*>
(
data
),
pitch
);
cv
::
cvtColor
(
tmp
,
tmp2
,
cv
::
COLOR_RGB2BGRA
);
cv
::
cvtColor
(
tmp
,
tmp2
,
cv
::
COLOR_RGB2BGRA
);
break
;
break
;
case
FTLIMAGE_RGB_FLOAT
:
tmp
=
cv
::
Mat
(
intrin
.
height
,
intrin
.
width
,
CV_32FC3
,
const_cast
<
void
*>
(
data
),
pitch
);
tmp
.
convertTo
(
tmp2
,
CV_8UC3
,
255.0
f
);
cv
::
cvtColor
(
tmp2
,
tmp2
,
cv
::
COLOR_RGB2BGRA
);
break
;
default
:
return
FTLERROR_STREAM_BAD_IMAGE_TYPE
;
default
:
return
FTLERROR_STREAM_BAD_IMAGE_TYPE
;
}
}
double
minVal
,
maxVal
;
cv
::
minMaxLoc
(
tmp
,
&
minVal
,
&
maxVal
);
LOG
(
INFO
)
<<
"MIN MAX "
<<
minVal
<<
" - "
<<
maxVal
;
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.
cv
::
flip
(
tmp2
,
tmp2
,
0
);
// Flip to get opencv form.
img
.
upload
(
tmp2
);
img
.
upload
(
tmp2
);
...
@@ -278,26 +286,27 @@ ftlError_t ftlDestroyStream(ftlStream_t stream) {
...
@@ -278,26 +286,27 @@ ftlError_t ftlDestroyStream(ftlStream_t stream) {
if
(
!
stream
)
return
FTLERROR_STREAM_INVALID_STREAM
;
if
(
!
stream
)
return
FTLERROR_STREAM_INVALID_STREAM
;
if
(
!
stream
->
stream
)
return
FTLERROR_STREAM_INVALID_STREAM
;
if
(
!
stream
->
stream
)
return
FTLERROR_STREAM_INVALID_STREAM
;
ftl
::
pool
.
push
([
stream
](
int
id
)
{
//
ftl::pool.push([stream](int id) {
//
ftlError_t err = FTLERROR_OK;
ftlError_t
err
=
FTLERROR_OK
;
if
(
stream
->
has_fresh_data
)
{
if
(
stream
->
has_fresh_data
)
{
try
{
try
{
cudaSetDevice
(
0
);
cudaSetDevice
(
0
);
stream
->
sender
->
post
(
stream
->
video_fs
);
stream
->
sender
->
post
(
stream
->
video_fs
);
}
catch
(
const
std
::
exception
&
e
)
{
}
catch
(
const
std
::
exception
&
e
)
{
//
err = FTLERROR_STREAM_ENCODE_FAILED;
err
=
FTLERROR_STREAM_ENCODE_FAILED
;
}
}
}
}
if
(
!
stream
->
stream
->
end
())
{
if
(
!
stream
->
stream
->
end
())
{
//
err = FTLERROR_STREAM_FILE_CREATE_FAILED;
err
=
FTLERROR_STREAM_FILE_CREATE_FAILED
;
}
}
if
(
stream
->
sender
)
delete
stream
->
sender
;
if
(
stream
->
sender
)
delete
stream
->
sender
;
delete
stream
->
stream
;
delete
stream
->
stream
;
stream
->
sender
=
nullptr
;
stream
->
sender
=
nullptr
;
stream
->
stream
=
nullptr
;
stream
->
stream
=
nullptr
;
delete
stream
;
delete
stream
;
});
//});
return
FTLERROR_OK
;
//return FTLERROR_OK;
return
err
;
}
}
This diff is collapsed.
Click to expand it.
SDK/Python/blender_script.py
+
6
−
4
View file @
df49b853
...
@@ -195,7 +195,8 @@ def render():
...
@@ -195,7 +195,8 @@ def render():
pix
=
np
.
array
(
pixels
.
pixels
[:])
pix
=
np
.
array
(
pixels
.
pixels
[:])
# sRGB conversion
# sRGB conversion
pix2
=
np
.
zeros
(
pix
.
shape
[:],
dtype
=
np
.
float
)
#pix2 = np.zeros(pix.shape[:], dtype=np.float)
pix2
=
np
.
copy
(
pix
)
np
.
copyto
(
pix2
,
1.055
*
(
pix
**
(
1.0
/
2.4
))
-
0.055
,
where
=
pix
<=
1
)
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
)
np
.
copyto
(
pix2
,
pix
*
12.92
,
where
=
pix
<=
0.0031308
)
...
@@ -204,12 +205,13 @@ def render():
...
@@ -204,12 +205,13 @@ def render():
im
=
pix2
.
reshape
((
pixels
.
size
[
1
],
pixels
.
size
[
0
],
pixels
.
channels
))
im
=
pix2
.
reshape
((
pixels
.
size
[
1
],
pixels
.
size
[
0
],
pixels
.
channels
))
im2
=
(
im
[:,:,
0
:
3
]).
astype
(
np
.
float32
)
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
return
(
im
[:,:,
0
:
3
]
*
255.0
).
astype
(
np
.
uint8
)
,
depthim
return
im
2
,
depthim
def
render_stereo
(
camera
,
baseline
=
0.15
):
def
render_stereo
(
camera
,
baseline
=
0.15
):
bpy
.
context
.
scene
.
camera
=
camera
bpy
.
context
.
scene
.
camera
=
camera
...
@@ -262,9 +264,9 @@ resolution_y_in_px = scale * bpy.context.scene.render.resolution_y
...
@@ -262,9 +264,9 @@ resolution_y_in_px = scale * bpy.context.scene.render.resolution_y
err
=
ftlIntrinsicsWriteLeft
(
c_void_p
(
stream
),
c_int
(
0
),
c_int
(
int
(
image
.
intrinsics
.
width
)),
c_int
(
int
(
image
.
intrinsics
.
height
)),
c_float
(
image
.
intrinsics
.
fx
),
c_float
(
image
.
intrinsics
.
cx
),
c_float
(
image
.
intrinsics
.
cy
),
c_float
(
image
.
intrinsics
.
baseline
),
c_float
(
image
.
intrinsics
.
min_depth
),
c_float
(
image
.
intrinsics
.
max_depth
))
err
=
ftlIntrinsicsWriteLeft
(
c_void_p
(
stream
),
c_int
(
0
),
c_int
(
int
(
image
.
intrinsics
.
width
)),
c_int
(
int
(
image
.
intrinsics
.
height
)),
c_float
(
image
.
intrinsics
.
fx
),
c_float
(
image
.
intrinsics
.
cx
),
c_float
(
image
.
intrinsics
.
cy
),
c_float
(
image
.
intrinsics
.
baseline
),
c_float
(
image
.
intrinsics
.
min_depth
),
c_float
(
image
.
intrinsics
.
max_depth
))
err
=
ftlIntrinsicsWriteRight
(
c_void_p
(
stream
),
c_int
(
0
),
c_int
(
int
(
image
.
intrinsics
.
width
)),
c_int
(
int
(
image
.
intrinsics
.
height
)),
c_float
(
image
.
intrinsics
.
fx
),
c_float
(
image
.
intrinsics
.
cx
),
c_float
(
image
.
intrinsics
.
cy
),
c_float
(
image
.
intrinsics
.
baseline
),
c_float
(
image
.
intrinsics
.
min_depth
),
c_float
(
image
.
intrinsics
.
max_depth
))
err
=
ftlIntrinsicsWriteRight
(
c_void_p
(
stream
),
c_int
(
0
),
c_int
(
int
(
image
.
intrinsics
.
width
)),
c_int
(
int
(
image
.
intrinsics
.
height
)),
c_float
(
image
.
intrinsics
.
fx
),
c_float
(
image
.
intrinsics
.
cx
),
c_float
(
image
.
intrinsics
.
cy
),
c_float
(
image
.
intrinsics
.
baseline
),
c_float
(
image
.
intrinsics
.
min_depth
),
c_float
(
image
.
intrinsics
.
max_depth
))
print
(
err
)
print
(
err
)
err
=
ftlImageWrite
(
stream
,
0
,
0
,
3
,
0
,
image
.
imL
.
ctypes
.
data_as
(
c_void_p
))
err
=
ftlImageWrite
(
stream
,
0
,
0
,
5
,
0
,
image
.
imL
.
ctypes
.
data_as
(
c_void_p
))
print
(
err
)
print
(
err
)
err
=
ftlImageWrite
(
stream
,
0
,
2
,
3
,
0
,
image
.
imR
.
ctypes
.
data_as
(
c_void_p
))
err
=
ftlImageWrite
(
stream
,
0
,
2
,
5
,
0
,
image
.
imR
.
ctypes
.
data_as
(
c_void_p
))
print
(
err
)
print
(
err
)
err
=
ftlImageWrite
(
stream
,
0
,
22
,
0
,
0
,
image
.
depthL
.
ctypes
.
data_as
(
c_void_p
))
err
=
ftlImageWrite
(
stream
,
0
,
22
,
0
,
0
,
image
.
depthL
.
ctypes
.
data_as
(
c_void_p
))
print
(
err
)
print
(
err
)
...
...
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