12 #ifdef BUILD_SHARED_LIBS 23 int main(
int argc,
char * argv[])
try 39 openvino::Core engine;
41 engine.SetLogCallback( error_listener );
45 engine.AddExtension( std::make_shared< openvino::Extensions::Cpu::CpuExtensions >(), device_name );
49 "face-detection-adas-0001.xml",
54 faceDetector.
load_into( engine, device_name );
56 catch(
const std::exception &
e )
63 LOG(ERROR) <<
"Failed to load model files:\n " << e.what();
64 LOG(
INFO) <<
"Please copy the model files into the working directory from which this sample is run";
69 const auto window_name =
"OpenVINO face detection sample";
70 cv::namedWindow( window_name, cv::WINDOW_AUTOSIZE );
72 bool first_frame =
true;
77 while( cv::getWindowProperty( window_name, cv::WND_PROP_AUTOSIZE ) >= 0 )
88 static uint64 last_frame_number = 0;
89 if(
color_frame.get_frame_number() == last_frame_number )
115 for(
auto const &
result : results )
118 rect = rect & cv::Rect( 0, 0,
image.cols,
image.rows );
122 face_ptr = std::make_shared< openvino_helpers::detected_object >(
id++,
std::string(), rect );
125 face_ptr->move( rect );
126 faces.push_back( face_ptr );
133 for(
auto &&
face : faces )
135 cv::Scalar
color( 255, 255, 255 );
136 auto r =
face->get_location();
137 cv::rectangle(
image,
r, color );
140 auto center_x =
r.x +
r.width / 2;
141 auto center_y =
r.y +
r.height / 2;
142 auto d =
depth_frame.get_distance( center_x, center_y );
145 std::ostringstream ss;
146 ss << std::setprecision( 2 ) <<
d;
148 cv::putText(
image, ss.str(),
cv::Point(
r.x + 5,
r.y +
r.height - 5 ), cv::FONT_HERSHEY_SIMPLEX, 0.3,
color );
152 imshow( window_name,
image );
153 if( cv::waitKey( 1 ) >= 0 )
164 catch (
const std::exception& e)
166 LOG(ERROR) <<
"Unknown exception caught: " << e.what();
frameset wait_for_frames(unsigned int timeout_ms=RS2_DEFAULT_TIMEOUT) const
static Logger * reconfigureLogger(Logger *logger, const Configurations &configurations)
Reconfigures specified logger with new configurations.
int main(int argc, char *argv[])
std::list< detected_object::ptr > detected_objects
void set(Level level, ConfigurationType configurationType, const std::string &value)
Sets value of configuration for specified level.
LOG(INFO)<< "Log message to default logger"
GLsizei const GLchar *const * string
GLenum GLenum GLsizei void * image
const std::string & get_failed_args() const
Determines format of logging corresponding level and logger.
#define INITIALIZE_EASYLOGGINGPP
frameset process(frameset frames)
void load_into(InferenceEngine::Core &ie, const std::string &deviceName)
void log_to_console(rs2_log_severity min_severity)
Thread-safe Configuration repository.
detected_object::ptr find_object(cv::Rect rect, detected_objects const &objects)
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
Generic level that represents all the levels. Useful when setting global configuration for all levels...
std::array< float, 3 > color
void enqueue(const cv::Mat &frame)
void submit_request() override
static cv::Mat frame_to_mat(const rs2::frame &f)
const std::string & get_failed_function() const
GLenum GLuint GLint GLenum face
::geometry_msgs::Point_< std::allocator< void > > Point
std::vector< Result > fetch_results()