a/tracing: Do more tracing in PSMV tracking code

This commit is contained in:
Jakob Bornecrantz 2022-11-23 17:45:11 +00:00 committed by Jakob Bornecrantz
parent f552aacb87
commit c195608602

View file

@ -21,6 +21,7 @@
#include "util/u_debug.h"
#include "util/u_frame.h"
#include "util/u_format.h"
#include "util/u_trace_marker.h"
#include "math/m_api.h"
@ -134,28 +135,40 @@ static_assert(std::is_standard_layout<TrackerPSMV>::value);
static void
do_view(TrackerPSMV &t, View &view, cv::Mat &grey, cv::Mat &rgb)
{
// Undistort and rectify the whole image.
cv::remap(grey, // src
view.frame_undist_rectified, // dst
view.undistort_rectify_map_x, // map1
view.undistort_rectify_map_y, // map2
cv::INTER_NEAREST, // interpolation
cv::BORDER_CONSTANT, // borderMode
cv::Scalar(0, 0, 0)); // borderValue
XRT_TRACE_MARKER();
cv::threshold(view.frame_undist_rectified, // src
view.frame_undist_rectified, // dst
32.0, // thresh
255.0, // maxval
0); // type
{
XRT_TRACE_IDENT(remap);
// tracker_measurement_t m = {};
// Undistort and rectify the whole image.
cv::remap(grey, // src
view.frame_undist_rectified, // dst
view.undistort_rectify_map_x, // map1
view.undistort_rectify_map_y, // map2
cv::INTER_NEAREST, // interpolation
cv::BORDER_CONSTANT, // borderMode
cv::Scalar(0, 0, 0)); // borderValue
}
// Do blob detection with our masks.
//! @todo Re-enable masks.
t.sbd->detect(view.frame_undist_rectified, // image
view.keypoints, // keypoints
cv::noArray()); // mask
{
XRT_TRACE_IDENT(threshold);
cv::threshold(view.frame_undist_rectified, // src
view.frame_undist_rectified, // dst
32.0, // thresh
255.0, // maxval
0); // type
}
{
XRT_TRACE_IDENT(detect);
// Do blob detection with our masks.
//! @todo Re-enable masks.
t.sbd->detect(view.frame_undist_rectified, // image
view.keypoints, // keypoints
cv::noArray()); // mask
}
// Debug is wanted, draw the keypoints.
@ -246,6 +259,8 @@ world_point_from_blobs(const cv::Point2f &left, const cv::Point2f &right, const
static void
process(TrackerPSMV &t, struct xrt_frame *xf)
{
XRT_TRACE_MARKER();
// Only IMU data: nothing to do
if (xf == NULL) {
return;
@ -350,6 +365,8 @@ process(TrackerPSMV &t, struct xrt_frame *xf)
static void
run(TrackerPSMV &t)
{
U_TRACE_SET_THREAD_NAME("PSMV");
struct xrt_frame *frame = NULL;
os_thread_helper_lock(&t.oth);
@ -549,6 +566,8 @@ t_psmv_create(struct xrt_frame_context *xfctx,
struct xrt_tracked_psmv **out_xtmv,
struct xrt_frame_sink **out_sink)
{
XRT_TRACE_MARKER();
U_LOG_D("Creating PSMV tracker.");
auto &t = *(new TrackerPSMV());