Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
TadasBaltrusaitis committed Jul 21, 2018
2 parents 7620b93 + 6609388 commit 424eec7
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 31 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ branches:
only:
- master
- develop
- feature/2.0.4
compiler:
- gcc

Expand Down
28 changes: 18 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,25 @@ else()
endif()

find_package( OpenCV 3.3 REQUIRED COMPONENTS core imgproc calib3d highgui objdetect)
MESSAGE("OpenCV information:")
MESSAGE(" OpenCV_INCLUDE_DIRS: ${OpenCV_INCLUDE_DIRS}")
MESSAGE(" OpenCV_LIBRARIES: ${OpenCV_LIBRARIES}")
MESSAGE(" OpenCV_LIBRARY_DIRS: ${OpenCV_LINK_DIRECTORIES}")
if(${OpenCV_FOUND})
MESSAGE("OpenCV information:")
MESSAGE(" OpenCV_INCLUDE_DIRS: ${OpenCV_INCLUDE_DIRS}")
MESSAGE(" OpenCV_LIBRARIES: ${OpenCV_LIBRARIES}")
MESSAGE(" OpenCV_LIBRARY_DIRS: ${OpenCV_LINK_DIRECTORIES}")
else()
MESSAGE(FATAL_ERROR "OpenCV not found in the system.")
endif()

find_package( Boost 1.5.9 REQUIRED COMPONENTS filesystem system)
MESSAGE("Boost information:")
MESSAGE(" Boost_VERSION: ${Boost_VERSION}")
MESSAGE(" Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
MESSAGE(" Boost_LIBRARIES: ${Boost_LIBRARIES}")
MESSAGE(" Boost_LIBRARY_DIRS: ${Boost_LIBRARY_DIRS}")
if(${Boost_FOUND})
MESSAGE("Boost information:")
MESSAGE(" Boost_VERSION: ${Boost_VERSION}")
MESSAGE(" Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
MESSAGE(" Boost_LIBRARIES: ${Boost_LIBRARIES}")
MESSAGE(" Boost_LIBRARY_DIRS: ${Boost_LIBRARY_DIRS}")
else()
MESSAGE(FATAL_ERROR "Boost not found in the system.")
endif()

# Try finding TBB in default location
find_package( TBB CONFIG )
Expand Down Expand Up @@ -116,7 +124,7 @@ foreach(file ${files})
endforeach()

# Move OpenCV classifiers
file(GLOB files "lib/3rdParty/OpenCV3.1/classifiers/*.xml")
file(GLOB files "lib/3rdParty/OpenCV3.4/classifiers/*.xml")
foreach(file ${files})
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/classifiers)
install(FILES ${file} DESTINATION ${CMAKE_CONFIG_DIR}/classifiers)
Expand Down
2 changes: 1 addition & 1 deletion lib/local/LandmarkDetector/src/FaceDetectorMTCNN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ bool FaceDetectorMTCNN::DetectFaces(vector<cv::Rect_<float> >& o_regions, const
// Force the image to three channels
if (img_in.channels() == 1)
{
cv::cvtColor(img_in, input_img, CV_GRAY2RGB);
cv::cvtColor(img_in, input_img, cv::COLOR_GRAY2RGB);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,15 @@ float DetectionValidator::Check(const cv::Vec3d& orientation, const cv::Mat_<uch
xs = xs - min_x;
ys = ys - min_y;

// If the ROI is non existent return failure (this could happen if all landmarks are outside of the image)
if (max_x - min_x <= 1 || max_y - min_y <= 1)
{
return 0.0f;
}

cv::Mat_<float> intensity_img_float_local;
intensity_img(cv::Rect(min_x, min_y, max_x - min_x, max_y - min_y)).convertTo(intensity_img_float_local, CV_32F);

// the piece-wise affine image warping
paws[id].Warp(intensity_img_float_local, warped, detected_landmarks_local);

Expand Down
2 changes: 1 addition & 1 deletion lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ namespace LandmarkDetector
for (int i = 0; i < n; ++i)
{
float val_x = landmarks.at<float>(i, 0);
float val_y = landmarks.at<float>(i, 0);
float val_y = landmarks.at<float>(i, 1);

if (i == 0 || val_x < min_x)
min_x = val_x;
Expand Down
8 changes: 4 additions & 4 deletions lib/local/Utilities/include/ImageManipulationHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ namespace Utilities
{
cv::Mat tmp = in / 256;
tmp.convertTo(out, CV_8U);
cv::cvtColor(out, out, CV_BGR2GRAY);
cv::cvtColor(out, out, cv::COLOR_BGR2GRAY);
}
else
{
cv::cvtColor(in, out, CV_BGR2GRAY);
cv::cvtColor(in, out, cv::COLOR_BGR2GRAY);
}
}
else if (in.channels() == 4)
Expand All @@ -65,11 +65,11 @@ namespace Utilities
{
cv::Mat tmp = in / 256;
tmp.convertTo(out, CV_8U);
cv::cvtColor(out, out, CV_BGRA2GRAY);
cv::cvtColor(out, out, cv::COLOR_BGRA2GRAY);
}
else
{
cv::cvtColor(in, out, CV_BGRA2GRAY);
cv::cvtColor(in, out, cv::COLOR_BGRA2GRAY);
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion lib/local/Utilities/src/VisualizationUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ namespace Utilities
// Only draw the line if one of the points is inside the image
if (p1.inside(image_rect) || p2.inside(image_rect))
{
cv::line(image, p1, p2, color, thickness, CV_AA);
cv::line(image, p1, p2, color, thickness, cv::LINE_AA);
}

}
Expand Down
26 changes: 13 additions & 13 deletions lib/local/Utilities/src/Visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ void Visualizer::SetObservationLandmarks(const cv::Mat_<float>& landmarks_2D, do
int thickness = (int)std::ceil(3.0* ((double)captured_image.cols) / 640.0);
int thickness_2 = (int)std::ceil(1.0* ((double)captured_image.cols) / 640.0);

cv::circle(captured_image, featurePoint, 1 * draw_multiplier, cv::Scalar(0, 0, 255), thickness, CV_AA, draw_shiftbits);
cv::circle(captured_image, featurePoint, 1 * draw_multiplier, cv::Scalar(255, 0, 0), thickness_2, CV_AA, draw_shiftbits);
cv::circle(captured_image, featurePoint, 1 * draw_multiplier, cv::Scalar(0, 0, 255), thickness, cv::LINE_AA, draw_shiftbits);
cv::circle(captured_image, featurePoint, 1 * draw_multiplier, cv::Scalar(255, 0, 0), thickness_2, cv::LINE_AA, draw_shiftbits);

}
else
Expand All @@ -199,8 +199,8 @@ void Visualizer::SetObservationLandmarks(const cv::Mat_<float>& landmarks_2D, do
int thickness = (int)std::ceil(2.5* ((double)captured_image.cols) / 640.0);
int thickness_2 = (int)std::ceil(1.0* ((double)captured_image.cols) / 640.0);

cv::circle(captured_image, featurePoint, 1 * draw_multiplier, cv::Scalar(0, 0, 155), thickness, CV_AA, draw_shiftbits);
cv::circle(captured_image, featurePoint, 1 * draw_multiplier, cv::Scalar(155, 0, 0), thickness_2, CV_AA, draw_shiftbits);
cv::circle(captured_image, featurePoint, 1 * draw_multiplier, cv::Scalar(0, 0, 155), thickness, cv::LINE_AA, draw_shiftbits);
cv::circle(captured_image, featurePoint, 1 * draw_multiplier, cv::Scalar(155, 0, 0), thickness_2, cv::LINE_AA, draw_shiftbits);

}
}
Expand Down Expand Up @@ -309,20 +309,20 @@ void Visualizer::SetObservationActionUnits(const std::vector<std::pair<std::stri
int offset = MARGIN_Y + idx * (AU_TRACKBAR_HEIGHT + 10);
std::ostringstream au_i;
au_i << std::setprecision(2) << std::setw(4) << std::fixed << intensity;
cv::putText(action_units_image, name, cv::Point(10, offset + 10), CV_FONT_HERSHEY_SIMPLEX, 0.5, CV_RGB(present ? 0 : 200, 0, 0), 1, CV_AA);
cv::putText(action_units_image, AUS_DESCRIPTION.at(name), cv::Point(55, offset + 10), CV_FONT_HERSHEY_SIMPLEX, 0.3, CV_RGB(0, 0, 0), 1, CV_AA);
cv::putText(action_units_image, name, cv::Point(10, offset + 10), cv::FONT_HERSHEY_SIMPLEX, 0.5, CV_RGB(present ? 0 : 200, 0, 0), 1, cv::LINE_AA);
cv::putText(action_units_image, AUS_DESCRIPTION.at(name), cv::Point(55, offset + 10), cv::FONT_HERSHEY_SIMPLEX, 0.3, CV_RGB(0, 0, 0), 1, cv::LINE_AA);

if (present)
{
cv::putText(action_units_image, au_i.str(), cv::Point(160, offset + 10), CV_FONT_HERSHEY_SIMPLEX, 0.3, CV_RGB(0, 100, 0), 1, CV_AA);
cv::putText(action_units_image, au_i.str(), cv::Point(160, offset + 10), cv::FONT_HERSHEY_SIMPLEX, 0.3, CV_RGB(0, 100, 0), 1, cv::LINE_AA);
cv::rectangle(action_units_image, cv::Point(MARGIN_X, offset),
cv::Point((int)(MARGIN_X + AU_TRACKBAR_LENGTH * intensity / 5.0), offset + AU_TRACKBAR_HEIGHT),
cv::Scalar(128, 128, 128),
CV_FILLED);
}
else
{
cv::putText(action_units_image, "0.00", cv::Point(160, offset + 10), CV_FONT_HERSHEY_SIMPLEX, 0.3, CV_RGB(0, 0, 0), 1, CV_AA);
cv::putText(action_units_image, "0.00", cv::Point(160, offset + 10), cv::FONT_HERSHEY_SIMPLEX, 0.3, CV_RGB(0, 0, 0), 1, cv::LINE_AA);
}
idx++;
}
Expand Down Expand Up @@ -363,9 +363,9 @@ void Visualizer::SetObservationGaze(const cv::Point3f& gaze_direction0, const cv

cv::Point nextFeaturePoint(cvRound(eye_landmarks2d[next_point].x * (double)draw_multiplier), cvRound(eye_landmarks2d[next_point].y * (double)draw_multiplier));
if ((i < 28 && (i < 8 || i > 19)) || (i >= 28 && (i < 8 + 28 || i > 19 + 28)))
cv::line(captured_image, featurePoint, nextFeaturePoint, cv::Scalar(255, 0, 0), thickness_2, CV_AA, draw_shiftbits);
cv::line(captured_image, featurePoint, nextFeaturePoint, cv::Scalar(255, 0, 0), thickness_2, cv::LINE_AA, draw_shiftbits);
else
cv::line(captured_image, featurePoint, nextFeaturePoint, cv::Scalar(0, 0, 255), thickness_2, CV_AA, draw_shiftbits);
cv::line(captured_image, featurePoint, nextFeaturePoint, cv::Scalar(0, 0, 255), thickness_2, cv::LINE_AA, draw_shiftbits);

}

Expand Down Expand Up @@ -395,12 +395,12 @@ void Visualizer::SetObservationGaze(const cv::Point3f& gaze_direction0, const cv
cv::Mat_<float> mesh_0 = (cv::Mat_<float>(2, 3) << points_left[0].x, points_left[0].y, points_left[0].z, points_left[1].x, points_left[1].y, points_left[1].z);
Project(proj_points, mesh_0, fx, fy, cx, cy);
cv::line(captured_image, cv::Point(cvRound(proj_points.at<float>(0, 0) * (float)draw_multiplier), cvRound(proj_points.at<float>(0, 1) * (float)draw_multiplier)),
cv::Point(cvRound(proj_points.at<float>(1, 0) * (float)draw_multiplier), cvRound(proj_points.at<float>(1, 1) * (float)draw_multiplier)), cv::Scalar(110, 220, 0), 2, CV_AA, draw_shiftbits);
cv::Point(cvRound(proj_points.at<float>(1, 0) * (float)draw_multiplier), cvRound(proj_points.at<float>(1, 1) * (float)draw_multiplier)), cv::Scalar(110, 220, 0), 2, cv::LINE_AA, draw_shiftbits);

cv::Mat_<float> mesh_1 = (cv::Mat_<float>(2, 3) << points_right[0].x, points_right[0].y, points_right[0].z, points_right[1].x, points_right[1].y, points_right[1].z);
Project(proj_points, mesh_1, fx, fy, cx, cy);
cv::line(captured_image, cv::Point(cvRound(proj_points.at<float>(0, 0) * (float)draw_multiplier), cvRound(proj_points.at<float>(0, 1) * (float)draw_multiplier)),
cv::Point(cvRound(proj_points.at<float>(1, 0) * (float)draw_multiplier), cvRound(proj_points.at<float>(1, 1) * (float)draw_multiplier)), cv::Scalar(110, 220, 0), 2, CV_AA, draw_shiftbits);
cv::Point(cvRound(proj_points.at<float>(1, 0) * (float)draw_multiplier), cvRound(proj_points.at<float>(1, 1) * (float)draw_multiplier)), cv::Scalar(110, 220, 0), 2, cv::LINE_AA, draw_shiftbits);

}
}
Expand All @@ -413,7 +413,7 @@ void Visualizer::SetFps(double fps)
std::sprintf(fpsC, "%d", (int)fps);
std::string fpsSt("FPS:");
fpsSt += fpsC;
cv::putText(captured_image, fpsSt, cv::Point(10, 20), CV_FONT_HERSHEY_SIMPLEX, 0.5, CV_RGB(255, 0, 0), 1, CV_AA);
cv::putText(captured_image, fpsSt, cv::Point(10, 20), cv::FONT_HERSHEY_SIMPLEX, 0.5, CV_RGB(255, 0, 0), 1, cv::LINE_AA);
}

char Visualizer::ShowObservation()
Expand Down

0 comments on commit 424eec7

Please sign in to comment.