Commit 2465def8 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

parents 24cd5e21 9005e9ea
...@@ -162,7 +162,7 @@ public: ...@@ -162,7 +162,7 @@ public:
@param src The training images, that means the faces you want to learn. The data has to be @param src The training images, that means the faces you want to learn. The data has to be
given as a vector\<Mat\>. given as a vector\<Mat\>.
@param labels The labels corresponding to the images have to be given either as a vector\<int\> @param labels The labels corresponding to the images have to be given either as a vector\<int\>
or a or a Mat of type CV_32SC1.
The following source code snippet shows you how to learn a Fisherfaces model on a given set of The following source code snippet shows you how to learn a Fisherfaces model on a given set of
images. The images are read with imread and pushed into a std::vector\<Mat\>. The labels of each images. The images are read with imread and pushed into a std::vector\<Mat\>. The labels of each
...@@ -175,6 +175,8 @@ public: ...@@ -175,6 +175,8 @@ public:
// holds images and labels // holds images and labels
vector<Mat> images; vector<Mat> images;
vector<int> labels; vector<int> labels;
// using Mat of type CV_32SC1
// Mat labels(number_of_samples, 1, CV_32SC1);
// images for first person // images for first person
images.push_back(imread("person0/0.jpg", IMREAD_GRAYSCALE)); labels.push_back(0); images.push_back(imread("person0/0.jpg", IMREAD_GRAYSCALE)); labels.push_back(0);
images.push_back(imread("person0/1.jpg", IMREAD_GRAYSCALE)); labels.push_back(0); images.push_back(imread("person0/1.jpg", IMREAD_GRAYSCALE)); labels.push_back(0);
...@@ -211,7 +213,7 @@ public: ...@@ -211,7 +213,7 @@ public:
@param src The training images, that means the faces you want to learn. The data has to be given @param src The training images, that means the faces you want to learn. The data has to be given
as a vector\<Mat\>. as a vector\<Mat\>.
@param labels The labels corresponding to the images have to be given either as a vector\<int\> or @param labels The labels corresponding to the images have to be given either as a vector\<int\> or
a a Mat of type CV_32SC1.
This method updates a (probably trained) FaceRecognizer, but only if the algorithm supports it. The This method updates a (probably trained) FaceRecognizer, but only if the algorithm supports it. The
Local Binary Patterns Histograms (LBPH) recognizer (see createLBPHFaceRecognizer) can be updated. Local Binary Patterns Histograms (LBPH) recognizer (see createLBPHFaceRecognizer) can be updated.
......
# define the source files
SET(BASE_SRC )
# define the header files (make the headers appear in IDEs.)
FILE(GLOB BASE_HDRS *.h)
ADD_LIBRARY(base STATIC ${BASE_SRC} ${BASE_HDRS})
LIBMV_INSTALL_LIB(base)
\ No newline at end of file
...@@ -8,6 +8,10 @@ FILE(GLOB CORRESPONDENCE_HDRS *.h) ...@@ -8,6 +8,10 @@ FILE(GLOB CORRESPONDENCE_HDRS *.h)
ADD_LIBRARY(correspondence STATIC ${CORRESPONDENCE_SRC} ${CORRESPONDENCE_HDRS}) ADD_LIBRARY(correspondence STATIC ${CORRESPONDENCE_SRC} ${CORRESPONDENCE_HDRS})
TARGET_LINK_LIBRARIES(correspondence multiview) TARGET_LINK_LIBRARIES(correspondence LINK_PRIVATE multiview)
IF(TARGET Eigen3::Eigen)
TARGET_LINK_LIBRARIES(correspondence LINK_PUBLIC Eigen3::Eigen)
ENDIF()
LIBMV_INSTALL_LIB(correspondence)
\ No newline at end of file LIBMV_INSTALL_LIB(correspondence)
...@@ -17,6 +17,9 @@ SET(MULTIVIEW_SRC conditioning.cc ...@@ -17,6 +17,9 @@ SET(MULTIVIEW_SRC conditioning.cc
FILE(GLOB MULTIVIEW_HDRS *.h) FILE(GLOB MULTIVIEW_HDRS *.h)
ADD_LIBRARY(multiview STATIC ${MULTIVIEW_SRC} ${MULTIVIEW_HDRS}) ADD_LIBRARY(multiview STATIC ${MULTIVIEW_SRC} ${MULTIVIEW_HDRS})
TARGET_LINK_LIBRARIES(multiview ${GLOG_LIBRARY} numeric) TARGET_LINK_LIBRARIES(multiview LINK_PRIVATE ${GLOG_LIBRARY} numeric)
IF(TARGET Eigen3::Eigen)
TARGET_LINK_LIBRARIES(multiview LINK_PUBLIC Eigen3::Eigen)
ENDIF()
LIBMV_INSTALL_LIB(multiview) LIBMV_INSTALL_LIB(multiview)
...@@ -7,6 +7,8 @@ FILE(GLOB NUMERIC_HDRS *.h) ...@@ -7,6 +7,8 @@ FILE(GLOB NUMERIC_HDRS *.h)
ADD_LIBRARY(numeric STATIC ${NUMERIC_SRC} ${NUMERIC_HDRS}) ADD_LIBRARY(numeric STATIC ${NUMERIC_SRC} ${NUMERIC_HDRS})
TARGET_LINK_LIBRARIES(numeric) IF(TARGET Eigen3::Eigen)
TARGET_LINK_LIBRARIES(numeric LINK_PUBLIC Eigen3::Eigen)
ENDIF()
LIBMV_INSTALL_LIB(numeric) LIBMV_INSTALL_LIB(numeric)
\ No newline at end of file
...@@ -17,6 +17,6 @@ FILE(GLOB SIMPLE_PIPELINE_HDRS *.h) ...@@ -17,6 +17,6 @@ FILE(GLOB SIMPLE_PIPELINE_HDRS *.h)
ADD_LIBRARY(simple_pipeline STATIC ${SIMPLE_PIPELINE_SRC} ${SIMPLE_PIPELINE_HDRS}) ADD_LIBRARY(simple_pipeline STATIC ${SIMPLE_PIPELINE_SRC} ${SIMPLE_PIPELINE_HDRS})
TARGET_LINK_LIBRARIES(simple_pipeline multiview ${CERES_LIBRARIES}) TARGET_LINK_LIBRARIES(simple_pipeline LINK_PRIVATE multiview ${CERES_LIBRARIES})
LIBMV_INSTALL_LIB(simple_pipeline) LIBMV_INSTALL_LIB(simple_pipeline)
\ No newline at end of file
...@@ -27,10 +27,6 @@ int main(int argc, char** argv) ...@@ -27,10 +27,6 @@ int main(int argc, char** argv)
return -1; return -1;
} }
// Create LSD detector
Ptr<LineSegmentDetector> lsd = createLineSegmentDetector();
vector<Vec4f> lines_lsd;
// Create FLD detector // Create FLD detector
// Param Default value Description // Param Default value Description
// length_threshold 10 - Segments shorter than this will be discarded // length_threshold 10 - Segments shorter than this will be discarded
...@@ -57,29 +53,18 @@ int main(int argc, char** argv) ...@@ -57,29 +53,18 @@ int main(int argc, char** argv)
vector<Vec4f> lines_fld; vector<Vec4f> lines_fld;
// Because of some CPU's power strategy, it seems that the first running of // Because of some CPU's power strategy, it seems that the first running of
// an algorithm takes much longer. So here we run both of the algorithmes 10 // an algorithm takes much longer. So here we run the algorithm 10 times
// times to see each algorithm's processing time with sufficiently warmed-up // to see the algorithm's processing time with sufficiently warmed-up
// CPU performance. // CPU performance.
for(int run_count = 0; run_count < 10; run_count++) { for(int run_count = 0; run_count < 10; run_count++) {
lines_lsd.clear();
int64 start_lsd = getTickCount();
lsd->detect(image, lines_lsd);
// Detect the lines with LSD
double freq = getTickFrequency(); double freq = getTickFrequency();
double duration_ms_lsd = double(getTickCount() - start_lsd) * 1000 / freq;
std::cout << "Elapsed time for LSD: " << duration_ms_lsd << " ms." << std::endl;
lines_fld.clear(); lines_fld.clear();
int64 start = getTickCount(); int64 start = getTickCount();
// Detect the lines with FLD // Detect the lines with FLD
fld->detect(image, lines_fld); fld->detect(image, lines_fld);
double duration_ms = double(getTickCount() - start) * 1000 / freq; double duration_ms = double(getTickCount() - start) * 1000 / freq;
std::cout << "Ealpsed time for FLD " << duration_ms << " ms." << std::endl; std::cout << "Elapsed time for FLD " << duration_ms << " ms." << std::endl;
} }
// Show found lines with LSD
Mat line_image_lsd(image);
lsd->drawSegments(line_image_lsd, lines_lsd);
imshow("LSD result", line_image_lsd);
// Show found lines with FLD // Show found lines with FLD
Mat line_image_fld(image); Mat line_image_fld(image);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment