Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example: T265 apriltag detection on host #4340

Merged
merged 27 commits into from
Jul 11, 2019

Conversation

honpong
Copy link
Contributor

@honpong honpong commented Jul 1, 2019

@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

if(frame_number % 4 == 0)
{
fisheye_frame.keep();
std::async(std::launch::async, [img=fisheye_frame,fn=frame_number,pose=camera_pose,&tag_manager](){
Copy link
Contributor

@dorian3d dorian3d Jul 3, 2019

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
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
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
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
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
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
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 👍

add comment about homography in undistorted image coordinate handling
Copy link
Collaborator

@ev-mp ev-mp left a comment

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
Collaborator

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
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
Copy link
Contributor Author

honpong commented Jul 11, 2019

Please add it to the demos list here

@ev-mp added

Copy link
Collaborator

@ev-mp ev-mp left a comment

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 IntelRealSense:development Jul 11, 2019
@mickeyouyou
Copy link
Contributor

mickeyouyou commented Jul 21, 2019

where this update went?

@honpong
Copy link
Contributor Author

honpong commented Jul 21, 2019

@mickeyouyou it has been merged into the development branch.

@mickeyouyou
Copy link
Contributor

yeah thank you so much for your contribution.

@patrickpoirier51
Copy link

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

@bfulkers-i
Copy link
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
Contributor

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

@honpong
Copy link
Contributor Author

honpong commented Nov 5, 2019

@neilyoung
Copy link
Contributor

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

@honpong
Copy link
Contributor Author

honpong commented Nov 5, 2019

@neilyoung, yes

@neilyoung
Copy link
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
Copy link
Contributor Author

honpong commented Nov 6, 2019

@neilyoung, please see my new comment #5184.

@neilyoung
Copy link
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