show_faces.cpp
Go to the documentation of this file.
1 #include <hri/hri.h>
2 #include <ros/ros.h>
3 
4 #include <opencv2/highgui.hpp>
5 
6 using namespace ros;
7 using namespace hri;
8 using namespace std;
9 
10 int main(int argc, char** argv)
11 {
12  ros::init(argc, argv, "hri_example_show_faces");
13 
14  ros::NodeHandle nh;
15 
16  ros::Rate loop_rate(10);
17 
18  HRIListener hri_listener;
19 
20  // hri_listener.onFace(&onFace);
21 
22  while (ros::ok())
23  {
24  auto faces = hri_listener.getFaces();
25  for (auto& f : faces)
26  {
27  auto face_id = f.first;
28  auto face = f.second.lock();
29  if (face)
30  {
31  if (!face->cropped().empty())
32  {
33  cv::imshow("Cropped face " + face_id, face->cropped());
34  }
35  if (!face->aligned().empty())
36  {
37  cv::imshow("Aligned face " + face_id, face->aligned());
38  }
39 
40  cv::waitKey(10);
41  }
42  }
43 
44  loop_rate.sleep();
45  ros::spinOnce();
46  }
47 
48  return 0;
49 }
hri
Definition: base.h:38
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
ros
ros.h
ros::spinOnce
ROSCPP_DECL void spinOnce()
ros::ok
ROSCPP_DECL bool ok()
f
f
hri.h
main
int main(int argc, char **argv)
Definition: show_faces.cpp:10
ros::Rate::sleep
bool sleep()
hri::HRIListener::getFaces
std::map< ID, FaceWeakConstPtr > getFaces() const
Returns the list of currently detected faces, mapped to their IDs.
Definition: hri.cpp:62
hri::face
@ face
Definition: base.h:47
hri::HRIListener
Main entry point to libhri. This is most likely what you want to use. Use example:
Definition: hri.h:70
std
ros::Rate
ros::NodeHandle


libhri
Author(s): Séverin Lemaignan
autogenerated on Thu Jul 6 2023 02:43:58