Skip to content

Commit

Permalink
Fix apriltag detector copy operator
Browse files Browse the repository at this point in the history
  • Loading branch information
fspindle committed Jul 24, 2024
1 parent 26e5878 commit b91ea97
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
26 changes: 26 additions & 0 deletions 3rdparty/apriltag/apriltag.c
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,32 @@ zarray_t* apriltag_detections_copy(zarray_t* detections)
return detections_copy;
}

apriltag_detector_t *apriltag_detector_copy(apriltag_detector_t *td)
{
apriltag_detector_t *td_copy = apriltag_detector_create();

td_copy->nthreads = td->nthreads;
td_copy->quad_decimate = td->quad_decimate;
td_copy->quad_sigma = td->quad_sigma;

td_copy->qtp.max_nmaxima = td->qtp.max_nmaxima ;
td_copy->qtp.min_cluster_pixels = td->qtp.min_cluster_pixels;

td_copy->qtp.max_line_fit_mse = td->qtp.max_line_fit_mse;
td_copy->qtp.cos_critical_rad = td->qtp.cos_critical_rad;
td_copy->qtp.deglitch = td->qtp.deglitch;
td_copy->qtp.min_white_black_diff = td->qtp.min_white_black_diff;

//td->tag_families = zarray_create(sizeof(apriltag_family_t *));
//td->tp = timeprofile_create();

td_copy->refine_edges = td->refine_edges;
td_copy->decode_sharpening = td->decode_sharpening;
td_copy->debug = td->debug;

return td_copy;
}

image_u8_t *apriltag_to_image(apriltag_family_t *fam, uint32_t idx)
{
assert(fam != NULL);
Expand Down
2 changes: 2 additions & 0 deletions 3rdparty/apriltag/apriltag.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ void apriltag_detection_copy(apriltag_detection_t* src, apriltag_detection_t* ds
// copy the array AND the detections within it.
zarray_t* apriltag_detections_copy(zarray_t* detections);

apriltag_detector_t *apriltag_detector_copy(apriltag_detector_t *td);

// Renders the apriltag.
// Caller is responsible for calling image_u8_destroy on the image
image_u8_t *apriltag_to_image(apriltag_family_t *fam, uint32_t idx);
Expand Down
5 changes: 2 additions & 3 deletions modules/detection/src/tag/vpDetectorAprilTag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
*
* Description:
* Base class for AprilTag detection.
*
*****************************************************************************/
*/
#include <visp3/core/vpConfig.h>

#ifdef VISP_HAVE_APRILTAG
Expand Down Expand Up @@ -201,7 +200,7 @@ class vpDetectorAprilTag::Impl
}

if ((m_tagFamily != TAG_36ARTOOLKIT) && m_tf) {
m_td = apriltag_detector_create();
m_td = apriltag_detector_copy(o.m_td);
apriltag_detector_add_family(m_td, m_tf);
}

Expand Down

0 comments on commit b91ea97

Please sign in to comment.