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
af5c7442
Commit
af5c7442
authored
4 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Remove old pylon files
parent
1c6d427b
No related branches found
No related tags found
1 merge request
!312
Support new basler cameras
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/rgbd-sources/src/sources/pylon/pylon.cpp
+0
-174
0 additions, 174 deletions
components/rgbd-sources/src/sources/pylon/pylon.cpp
components/rgbd-sources/src/sources/pylon/pylon.hpp
+0
-40
0 additions, 40 deletions
components/rgbd-sources/src/sources/pylon/pylon.hpp
with
0 additions
and
214 deletions
components/rgbd-sources/src/sources/pylon/pylon.cpp
deleted
100644 → 0
+
0
−
174
View file @
1c6d427b
#include
"pylon.hpp"
#include
<loguru.hpp>
#include
<ftl/threads.hpp>
#include
<ftl/rgbd/source.hpp>
#include
<pylon/PylonIncludes.h>
#include
<pylon/BaslerUniversalInstantCamera.h>
#include
<opencv2/imgproc.hpp>
using
ftl
::
rgbd
::
detail
::
PylonSource
;
using
std
::
string
;
using
ftl
::
codecs
::
Channel
;
using
cv
::
cuda
::
GpuMat
;
using
namespace
Pylon
;
PylonSource
::
PylonSource
(
ftl
::
rgbd
::
Source
*
host
)
:
ftl
::
rgbd
::
BaseSourceImpl
(
host
),
ready_
(
false
),
lcam_
(
nullptr
),
rcam_
(
nullptr
)
{
capabilities_
=
kCapVideo
;
auto
&
inst
=
CTlFactory
::
GetInstance
();
Pylon
::
DeviceInfoList_t
devices
;
inst
.
EnumerateDevices
(
devices
);
if
(
devices
.
size
()
==
0
)
{
LOG
(
ERROR
)
<<
"No Pylon devices attached"
;
return
;
}
else
{
for
(
auto
d
:
devices
)
{
LOG
(
INFO
)
<<
" - found Pylon device - "
<<
d
.
GetFullName
()
<<
"("
<<
d
.
GetModelName
()
<<
")"
;
}
}
try
{
lcam_
=
new
CBaslerUniversalInstantCamera
(
CTlFactory
::
GetInstance
().
CreateDevice
(
devices
[
0
]));
lcam_
->
RegisterConfiguration
(
new
Pylon
::
CSoftwareTriggerConfiguration
,
Pylon
::
RegistrationMode_ReplaceAll
,
Pylon
::
Cleanup_Delete
);
lcam_
->
Open
();
if
(
devices
.
size
()
>=
2
)
{
rcam_
=
new
CBaslerUniversalInstantCamera
(
CTlFactory
::
GetInstance
().
CreateDevice
(
devices
[
1
]));
rcam_
->
RegisterConfiguration
(
new
Pylon
::
CSoftwareTriggerConfiguration
,
Pylon
::
RegistrationMode_ReplaceAll
,
Pylon
::
Cleanup_Delete
);
rcam_
->
Open
();
}
_configureCamera
(
lcam_
);
if
(
rcam_
)
_configureCamera
(
rcam_
);
lcam_
->
StartGrabbing
(
Pylon
::
GrabStrategy_OneByOne
);
ready_
=
true
;
}
catch
(
const
Pylon
::
GenericException
&
e
)
{
// Error handling.
LOG
(
ERROR
)
<<
"Pylon: An exception occurred - "
<<
e
.
GetDescription
();
}
/*params_.width = intrin.width;
params_.height = intrin.height;
params_.cx = -intrin.ppx;
params_.cy = -intrin.ppy;
params_.fx = intrin.fx;
params_.fy = intrin.fy;
params_.maxDepth = 3.0;
params_.minDepth = 0.1;
params_.doffs = 0.0;*/
state_
.
getLeft
()
=
params_
;
}
PylonSource
::~
PylonSource
()
{
}
void
PylonSource
::
_configureCamera
(
CBaslerUniversalInstantCamera
*
cam
)
{
// Get the camera control object.
GenApi
::
INodeMap
&
nodemap
=
cam
->
GetNodeMap
();
// Get the parameters for setting the image area of interest (Image AOI).
CIntegerParameter
width
(
nodemap
,
"Width"
);
CIntegerParameter
height
(
nodemap
,
"Height"
);
CIntegerParameter
offsetX
(
nodemap
,
"OffsetX"
);
CIntegerParameter
offsetY
(
nodemap
,
"OffsetY"
);
params_
.
width
=
width
.
GetValue
();
params_
.
height
=
height
.
GetValue
();
LOG
(
INFO
)
<<
"Camera resolution = "
<<
params_
.
width
<<
"x"
<<
params_
.
height
;
// Set the pixel data format.
CEnumParameter
format
(
nodemap
,
"PixelFormat"
);
LOG
(
INFO
)
<<
"Camera format: "
<<
format
.
GetValue
();
if
(
format
.
CanSetValue
(
"BayerBG8"
))
{
// YCbCr422_8
format
.
SetValue
(
"BayerBG8"
);
}
else
{
LOG
(
WARNING
)
<<
"Could not change pixel format"
;
}
}
bool
PylonSource
::
capture
(
int64_t
ts
)
{
if
(
!
isReady
())
return
false
;
try
{
lcam_
->
WaitForFrameTriggerReady
(
30
,
Pylon
::
TimeoutHandling_ThrowException
);
if
(
rcam_
)
rcam_
->
WaitForFrameTriggerReady
(
30
,
Pylon
::
TimeoutHandling_ThrowException
);
lcam_
->
ExecuteSoftwareTrigger
();
if
(
rcam_
)
rcam_
->
ExecuteSoftwareTrigger
();
}
catch
(
const
GenericException
&
e
)
{
LOG
(
ERROR
)
<<
"Pylon: Trigger exception - "
<<
e
.
GetDescription
();
}
return
true
;
}
bool
PylonSource
::
retrieve
(
ftl
::
rgbd
::
Frame
&
frame
)
{
if
(
!
isReady
())
return
false
;
frame
.
reset
();
frame
.
setOrigin
(
&
state_
);
try
{
/*if ( lcam_->GetGrabResultWaitObject().Wait(40)) {
LOG(INFO) << "Grad result waiting";
} else {
LOG(INFO) << "No results";
return false;
}*/
Pylon
::
CGrabResultPtr
result_left
;
Pylon
::
CGrabResultPtr
result_right
;
int
lcount
=
0
;
if
(
lcam_
->
RetrieveResult
(
0
,
result_left
,
Pylon
::
TimeoutHandling_Return
))
++
lcount
;
int
rcount
=
0
;
if
(
rcam_
&&
rcam_
->
RetrieveResult
(
0
,
result_right
,
Pylon
::
TimeoutHandling_Return
))
++
rcount
;
if
(
lcount
==
0
||
!
result_left
->
GrabSucceeded
())
{
LOG
(
ERROR
)
<<
"Retrieve failed"
;
return
false
;
}
cv
::
Mat
wrap_left
(
result_left
->
GetHeight
(),
result_left
->
GetWidth
(),
CV_8UC1
,
(
uint8_t
*
)
result_left
->
GetBuffer
());
cv
::
cvtColor
(
wrap_left
,
tmp_
,
cv
::
COLOR_BayerBG2BGRA
);
frame
.
create
<
cv
::
cuda
::
GpuMat
>
(
ftl
::
codecs
::
Channel
::
Colour
).
upload
(
tmp_
);
if
(
rcount
>
0
&&
result_right
->
GrabSucceeded
())
{
cv
::
Mat
wrap_right
(
result_right
->
GetHeight
(),
result_right
->
GetWidth
(),
CV_8UC1
,
(
uint8_t
*
)
result_right
->
GetBuffer
());
cv
::
cvtColor
(
wrap_right
,
tmp_
,
cv
::
COLOR_BayerBG2BGRA
);
frame
.
create
<
cv
::
cuda
::
GpuMat
>
(
ftl
::
codecs
::
Channel
::
Colour2
).
upload
(
tmp_
);
}
}
catch
(
const
GenericException
&
e
)
{
LOG
(
ERROR
)
<<
"Pylon: An exception occurred - "
<<
e
.
GetDescription
();
}
return
true
;
}
bool
PylonSource
::
isReady
()
{
return
lcam_
&&
lcam_
->
IsOpen
();
}
This diff is collapsed.
Click to expand it.
components/rgbd-sources/src/sources/pylon/pylon.hpp
deleted
100644 → 0
+
0
−
40
View file @
1c6d427b
#pragma once
#ifndef _FTL_RGBD_PYLON_HPP_
#define _FTL_RGBD_PYLON_HPP_
#include
"../../basesource.hpp"
#include
<string>
namespace
Pylon
{
class
CBaslerUniversalInstantCamera
;
}
namespace
ftl
{
namespace
rgbd
{
namespace
detail
{
class
PylonSource
:
public
ftl
::
rgbd
::
BaseSourceImpl
{
public:
explicit
PylonSource
(
ftl
::
rgbd
::
Source
*
host
);
~
PylonSource
();
bool
capture
(
int64_t
ts
);
bool
retrieve
(
ftl
::
rgbd
::
Frame
&
frame
);
bool
isReady
();
private:
bool
ready_
;
Pylon
::
CBaslerUniversalInstantCamera
*
lcam_
;
Pylon
::
CBaslerUniversalInstantCamera
*
rcam_
;
cv
::
Mat
tmp_
;
void
_configureCamera
(
Pylon
::
CBaslerUniversalInstantCamera
*
cam
);
};
}
}
}
#endif // _FTL_RGBD_PYLON_HPP_
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