Skip to content

example: T265 apriltag detection on host - #4340

Merged
ev-mp merged 27 commits into
realsenseai:developmentfrom
honpong:t265-apriltag-host
Jul 11, 2019
Merged

example: T265 apriltag detection on host #4340
ev-mp merged 27 commits into
realsenseai:developmentfrom
honpong:t265-apriltag-host

Conversation

@honpong

@honpong honpong commented Jul 1, 2019

Copy link
Copy Markdown
Contributor

@dorodnic I wrote a simple example of t265 apriltag detection running on host. Here we assume the apriltag detection library has been installed in the default path, e.g /usr/local/lib, and cmake find library from there. If no apriltag library found, this sample will simply not be added to the solution.

If this is not the expected way of cmake configuration, please suggest how to properly link a thirdparty library (Apriltag detection) in a librealsense example, the best if you can provide us a blank cmake template.

cc @dorian3d @bfulkers-i @harville

@honpong
honpong force-pushed the t265-apriltag-host branch from cb2714f to 438bedd Compare July 3, 2019 08:05
if(frame_number % 4 == 0)
{
fisheye_frame.keep();
std::async(std::launch::async, [img=fisheye_frame,fn=frame_number,pose=camera_pose,&tag_manager](){

@dorian3d dorian3d Jul 3, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialization in lambda captures is a C++14 feature. You may need to stick to C++11 unless it is ok for libRealSense to change the standard in a single sample.

If the latter, set_target_properties(rs-pose-apriltag PROPERTIES CXX_STANDARD 14) has to be added to cmake.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to use std::bind()

}
A[col*9 + 8] = (A[col*9 + 8] - sum)/A[col*9 + col];
}
return matd_create_data(3, 3, (double[]) { A[8], A[17], A[26], A[35], A[44], A[53], A[62], A[71], 1 });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

g++ complains here about taking the address of a temporary array.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to direct memory assignement

find_path(APRILTAG_INC NAMES apriltag.h PATH_SUFFIXES apriltag)
find_library(APRILTAG_LIB apriltag)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(apriltag DEFAULT_MSG APRILTAG_INC APRILTAG_LIB)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my setup, I installed the apriltag library in a custom directory. The only way of making it work was to set APRILTAG_INC=mypath/install/include/apriltag and APRILTAG_LIB=mypath/install/lib/libapriltag.so in cmake. Note that I had to specify the inner subdirectory in include/apriltag and the library file libapriltag.so. Setting CMAKE_PREFIX_PATH didn't help, or I didn't do it correctly.

Is this behavior expected?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dorian3d, CMAKE_PREFIX_PATH should work. Make sure to kill your build directory if you forgot to set CMAKE_PREFIX_PATH the first time, or run cmake -UAPRILTAG_INC -UAPRILTAG_LIB . to force the auto-detection to happen again.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting from scratch helped and CMAKE_PREFIX_PATH works 👍

@bfulkers-i
bfulkers-i force-pushed the t265-apriltag-host branch from 95a1272 to 3e36c94 Compare July 8, 2019 15:23
honpong added 2 commits July 9, 2019 15:21
add comment about homography in undistorted image coordinate handling

@ev-mp ev-mp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add it to the demos list here


## Dependency

This sample requires the [Apriltag library 3.1.1](https://github.com/AprilRobotics/apriltag/tree/3.1.1) installed in the default location suggested by the library or a path specified in cmake variable `CMAKE_PREFIX_PATH`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order for the demo to be built into distribution images (both Win and Linux) all the dependencies should be embedded into the project's Cmake ( see Libusb dependency, for instance).
So for now it will be available via the manual build only.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ev-mp I think we are okay via manual build at this moment.

rs-pose-apriltag: add item in the readme index page of examples
@honpong

honpong commented Jul 11, 2019

Copy link
Copy Markdown
Contributor Author

Please add it to the demos list here

@ev-mp added

@ev-mp ev-mp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@honpong, thanks for the demo!

@ev-mp
ev-mp merged commit 506b040 into realsenseai:development Jul 11, 2019
@mickeyouyou

mickeyouyou commented Jul 21, 2019

Copy link
Copy Markdown
Contributor

where this update went?

@honpong

honpong commented Jul 21, 2019

Copy link
Copy Markdown
Contributor Author

@mickeyouyou it has been merged into the development branch.

@mickeyouyou

Copy link
Copy Markdown
Contributor

yeah thank you so much for your contribution.

@patrickpoirier51

Copy link
Copy Markdown

So I guess we use this one ?
https://github.com/AprilRobotics/apriltag

@bfulkers-i

Copy link
Copy Markdown
Contributor

@patrickpoirier51 correct, this example uses https://github.com/AprilRobotics/apriltag. Check the example readme at https://github.com/IntelRealSense/librealsense/tree/master/examples/pose-apriltag for instructions including how to install the Apriltag library locally and get CMake to find it.

@neilyoung

Copy link
Copy Markdown
Contributor

@honpong Thanks for this neat contribution. Do you know a way in order to make this detection available for a python script?

@honpong

honpong commented Nov 5, 2019

Copy link
Copy Markdown
Contributor Author

@neilyoung

Copy link
Copy Markdown
Contributor

@honpong Great reference. Many thanks. May I ask you two easy questions regarding your sample?

@honpong

honpong commented Nov 5, 2019

Copy link
Copy Markdown
Contributor Author

@neilyoung, yes

@neilyoung

Copy link
Copy Markdown
Contributor

@honpong Many thanks. I first need to check an assumption I made regarding your sample code. Could you confirm this assumption? Please find it here #5184

@honpong

honpong commented Nov 6, 2019

Copy link
Copy Markdown
Contributor Author

@neilyoung, please see my new comment #5184.

@neilyoung

Copy link
Copy Markdown
Contributor

@honpong Yepp, added yet another comment :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants