Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,11 @@ If you prefer using the gui version of cmake (cmake-gui), then, you can add `ope
6. press the `configure` button followed by the `generate` button (the first time, you will be asked which makefile style to use)

7. build the `opencv` core with the method you chose (make and make install if you chose Unix makfile at step 6)

### Update the repository documentation

In order to keep a clean overview containing all contributed modules the following files need to be created/adapted.

1. Update the README.md file under the modules folder. Here you add your model with a single line description.

2. Add a README.md inside your own module folder. This README explains which functionality (seperate functions) is available, links to the corresponding samples and explains in somewhat more detail what the module is expected to do. If any extra requirements are needed to build the module without problems, add them here also.
50 changes: 49 additions & 1 deletion modules/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,49 @@
Please put your module here.
An overview of the contrib modules and a small explanation
----------------------------------------------------------

This list gives an overview of all modules available inside the contrib repository.
These are also the correct names for disabling the building of a specific module by adding

```
$ cmake -D OPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules -D BUILD_opencv_reponame=OFF <opencv_source_directory>
```

1. **opencv_adas**: Advanced Driver Assistance Systems module with Forward Collision Warning.

2. **opencv_bgsegm**: Improved Adaptive Background Mixture Model for Real-time Tracking / Visual Tracking of Human Visitors under Variable-Lighting Conditions.

3. **opencv_bioinspired**: Biologically inspired vision models and derivated tools.

4. **opencv_ ccalib**: Custom Calibration Pattern for 3D reconstruction.

5. **opencv_cvv**: GUI for Interactive Visual Debugging of Computer Vision Programs.

6. **opencv_datasettools**: Tools for working with different datasets.

7. **opencv_face**: Recently added face recognition software which is not yet stabalized.

8. **opencv_line_descriptor**: Binary descriptors for lines extracted from an image.

9. **opencv_matlab**: OpenCV Matlab Code Generator.

10. **opencv_optflow**: Optical Flow Algorithms for tracking points.

11. **opencv_reg**: Image Registration module.

12. **opencv_rgbd**: RGB-Depth Processing module.

13. **opencv_saliency**: Saliency API, understanding where humans focus given a scene.

14. **opencv_surface_matching**: Surface Matching Algorithm Through 3D Features.

15. **opencv_text**: Scene Text Detection and Recognition in Natural Scene Images.

16. **opencv_tracking**: Long-term optical tracking API.

17. **opencv_xfeatures2d**: Extra 2D Features Framework containing experimental and non-free 2D feature algorithms.

18. **opencv_ximgproc**: Extended Image Processing: Structured Forests / Domain Transform Filter / Guided Filter / Adaptive Manifold Filter / Joint Bilateral Filter / Superpixels.

19. **opencv_xobjdetect**: Integral Channel Features Detector Framework.

20. **opencv_xphoto**: Additional photo processing algorithms: Color balance / Denoising / Inpainting.
2 changes: 2 additions & 0 deletions modules/adas/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ADAS: Advanced Driver Assistance Systems module with Forward Collision Warning
==============================================================================
56 changes: 48 additions & 8 deletions modules/adas/tools/fcw_detect/fcw_detect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,29 @@ static Mat visualize(const Mat &image, const vector<Rect> &objects)
}
return img;
}
static bool read_window_size(const char *str, int *rows, int *cols)
{
int pos = 0;
if( sscanf(str, "%dx%d%n", rows, cols, &pos) != 2 || str[pos] != '\0' ||
*rows <= 0 || *cols <= 0)
{
return false;
}
return true;
}

int main(int argc, char *argv[])
{
const string keys =
"{help | | print this message}"
"{model_filename | model.xml | filename for reading model}"
"{image_path | test.png | path to image for detection}"
"{out_image_path | out.png | path to image for output}"
"{threshold | 0.0 | threshold for cascade}"
"{help | | print this message}"
"{model_filename | model.xml | filename for reading model}"
"{image_path | test.png | path to image for detection}"
"{out_image_path | out.png | path to image for output}"
"{threshold | 0.0 | threshold for cascade}"
"{step | 8 | sliding window step}"
"{min_window_size | 40x40 | min window size in pixels}"
"{max_window_size | 300x300 | max window size in pixels}"
"{is_grayscale | false | read the image as grayscale}"
;

CommandLineParser parser(argc, argv, keys);
Expand All @@ -71,7 +85,31 @@ int main(int argc, char *argv[])
string model_filename = parser.get<string>("model_filename");
string image_path = parser.get<string>("image_path");
string out_image_path = parser.get<string>("out_image_path");
bool is_grayscale = parser.get<bool>("is_grayscale");
float threshold = parser.get<float>("threshold");
int step = parser.get<int>("step");

int min_rows, min_cols, max_rows, max_cols;
string min_window_size = parser.get<string>("min_window_size");
if( !read_window_size(min_window_size.c_str(), &min_rows,
&min_cols) )
{
cerr << "Error reading min window size from `" << min_window_size << "`" << endl;
return 1;
}
string max_window_size = parser.get<string>("max_window_size");
if( !read_window_size(max_window_size.c_str(), &max_rows,
&max_cols) )
{
cerr << "Error reading max window size from `" << max_window_size << "`" << endl;
return 1;
}

int color;
if(is_grayscale == false)
color = cv::IMREAD_COLOR;
else
color = cv::IMREAD_GRAYSCALE;


if( !parser.check() )
Expand All @@ -85,8 +123,10 @@ int main(int argc, char *argv[])
detector.read(fs["icfdetector"]);
fs.release();
vector<Rect> objects;
Mat img = imread(image_path);
detector.detect(img, objects, 1.1f, Size(40, 40),
Size(300, 300), threshold);
Mat img = imread(image_path, color);
std::vector<float> values;
detector.detect(img, objects, 1.1f, Size(min_cols, min_rows), Size(max_cols, max_rows), threshold, step, values);
imwrite(out_image_path, visualize(img, objects));


}
83 changes: 76 additions & 7 deletions modules/adas/tools/fcw_train/fcw_train.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ using cv::imread;
#include <opencv2/core/utility.hpp>
using cv::CommandLineParser;
using cv::FileStorage;
#include <opencv2/core/utility.hpp>

#include <ctime> // std::time
#include <cstdlib> // std::rand, std::srand

#include <opencv2/xobjdetect.hpp>


using cv::xobjdetect::ICFDetectorParams;
using cv::xobjdetect::ICFDetector;
using cv::xobjdetect::WaldBoost;
Expand All @@ -46,8 +51,11 @@ static bool read_model_size(const char *str, int *rows, int *cols)
return true;
}

static int randomPred (int i) { return std::rand()%i;}

int main(int argc, char *argv[])
{

const string keys =
"{help | | print this message}"
"{pos_path | pos | path to training object samples}"
Expand All @@ -57,8 +65,15 @@ int main(int argc, char *argv[])
"{weak_count | 100 | number of weak classifiers in cascade}"
"{model_size | 40x40 | model size in pixels}"
"{model_filename | model.xml | filename for saving model}"
"{features_type | icf | features type, \"icf\" or \"acf\"}"
"{alpha | 0.02 | alpha value}"
"{is_grayscale | false | read the image as grayscale}"
"{use_fast_log | false | use fast log function}"
"{limit_ps | -1 | limit to positive samples (-1 means all)}"
"{limit_bg | -1 | limit to negative samples (-1 means all)}"
;


CommandLineParser parser(argc, argv, keys);
parser.about("FCW trainer");

Expand All @@ -76,15 +91,22 @@ int main(int argc, char *argv[])
params.feature_count = parser.get<int>("feature_count");
params.weak_count = parser.get<int>("weak_count");
params.bg_per_image = parser.get<int>("bg_per_image");

params.features_type = parser.get<string>("features_type");
params.alpha = parser.get<float>("alpha");
params.is_grayscale = parser.get<bool>("is_grayscale");
params.use_fast_log = parser.get<bool>("use_fast_log");

int limit_ps = parser.get<int>("limit_ps");
int limit_bg = parser.get<int>("limit_bg");

string model_size = parser.get<string>("model_size");
if( !read_model_size(model_size.c_str(), &params.model_n_rows,
&params.model_n_cols) )
{
cerr << "Error reading model size from `" << model_size << "`" << endl;
return 1;
}

if( params.feature_count <= 0 )
{
cerr << "feature_count must be positive number" << endl;
Expand All @@ -97,20 +119,67 @@ int main(int argc, char *argv[])
return 1;
}

if( params.bg_per_image <= 0 )
if( params.features_type != "icf" && params.features_type != "acf" )
{
cerr << "bg_per_image must be positive number" << endl;
cerr << "features_type must be \"icf\" or \"acf\"" << endl;
return 1;
}
if( params.alpha <= 0 )
{
cerr << "alpha must be positive float number" << endl;
return 1;
}

if( !parser.check() )
{
parser.printErrors();
return 1;
}

std::vector<cv::String> pos_filenames;
glob(pos_path, pos_filenames);

std::vector<cv::String> bg_filenames;
glob(bg_path, bg_filenames);

if(limit_ps != -1 && (int)pos_filenames.size() > limit_ps)
pos_filenames.erase(pos_filenames.begin()+limit_ps, pos_filenames.end());
if(limit_bg != -1 && (int)bg_filenames.size() > limit_bg)
bg_filenames.erase(bg_filenames.begin()+limit_bg, bg_filenames.end());

//random pick input images
bool random_shuffle = false;
if(random_shuffle)
{
std::srand ( unsigned ( std::time(0) ) );
std::random_shuffle ( pos_filenames.begin(), pos_filenames.end(), randomPred );
std::random_shuffle ( bg_filenames.begin(), bg_filenames.end(), randomPred );
}

int samples_size = (int)((params.bg_per_image * bg_filenames.size()) + pos_filenames.size());
int features_size = params.feature_count;
int max_features_allowed = (int)(INT_MAX/(sizeof(int)* samples_size));
int max_samples_allowed = (int)(INT_MAX/(sizeof(int)* features_size));
int total_samples = (int)((params.bg_per_image * bg_filenames.size()) + pos_filenames.size());


if(total_samples >max_samples_allowed)
{
CV_Error_(1, ("exceeded maximum number of samples. Maximum number of samples with %d features is %d, you have %d (%d positive samples + (%d bg * %d bg_per_image))\n",features_size,max_samples_allowed,total_samples,pos_filenames.size(),bg_filenames.size(),params.bg_per_image ));
}

if(params.feature_count >max_features_allowed)
{
CV_Error_(1, ("exceeded maximum number of features. Maximum number of features with %d samples is %d, you have %d\n",samples_size,max_features_allowed, features_size ));
}

std::cout<<pos_filenames.size()<<std::endl;
std::cout<<bg_filenames.size()<<std::endl;

ICFDetector detector;


detector.train(pos_filenames, bg_filenames, params);

ICFDetector detector;
detector.train(pos_path, bg_path, params);
FileStorage fs(model_filename, FileStorage::WRITE);
fs << "icfdetector";
detector.write(fs);
Expand Down
5 changes: 5 additions & 0 deletions modules/bgsegm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Improved Background-Foreground Segmentation Methods
===================================================

1. Adaptive Background Mixture Model for Real-time Tracking
2. Visual Tracking of Human Visitors under Variable-Lighting Conditions.
2 changes: 2 additions & 0 deletions modules/bioinspired/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Biologically inspired vision models and derivated tools
=======================================================
5 changes: 2 additions & 3 deletions modules/bioinspired/include/opencv2/bioinspired/retina.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ enum {
};

/**
* @class Retina a wrapper class which allows the Gipsa/Listic Labs model to be used with OpenCV.
* a wrapper class which allows the Gipsa/Listic Labs model to be used with OpenCV.
* This retina model allows spatio-temporal image processing (applied on still images, video sequences).
* As a summary, these are the retina model properties:
* => It applies a spectral whithening (mid-frequency details enhancement)
Expand Down Expand Up @@ -176,7 +176,6 @@ class CV_EXPORTS_W Retina : public Algorithm {
* => if the xml file does not exist, then default setup is applied
* => warning, Exceptions are thrown if read XML file is not valid
* @param newParameters : a parameters structures updated with the new target configuration
* @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error
*/
CV_WRAP virtual void setup(RetinaParameters newParameters)=0;

Expand All @@ -193,7 +192,7 @@ class CV_EXPORTS_W Retina : public Algorithm {

/**
* write xml/yml formated parameters information
* @rparam fs : the filename of the xml file that will be open and writen with formatted parameters information
* @param fs : the filename of the xml file that will be open and writen with formatted parameters information
*/
CV_WRAP virtual void write( String fs ) const=0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace cv{
namespace bioinspired{

/**
* @class RetinaFastToneMappingImpl a wrapper class which allows the tone mapping algorithm of Meylan&al(2007) to be used with OpenCV.
* a wrapper class which allows the tone mapping algorithm of Meylan&al(2007) to be used with OpenCV.
* This algorithm is already implemented in thre Retina class (retina::applyFastToneMapping) but used it does not require all the retina model to be allocated. This allows a light memory use for low memory devices (smartphones, etc.
* As a summary, these are the model properties:
* => 2 stages of local luminance adaptation with a different local neighborhood for each.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class CV_EXPORTS_W TransientAreasSegmentationModule: public Algorithm
* try to open an XML segmentation parameters file to adjust current segmentation instance setup
* => if the xml file does not exist, then default setup is applied
* => warning, Exceptions are thrown if read XML file is not valid
* @param retinaParameterFile : the parameters filename
* @param segmentationParameterFile : the parameters filename
* @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error
*/
CV_WRAP virtual void setup(String segmentationParameterFile="", const bool applyDefaultSetupOnFailure=true)=0;
Expand All @@ -135,7 +135,6 @@ class CV_EXPORTS_W TransientAreasSegmentationModule: public Algorithm
* => if the xml file does not exist, then default setup is applied
* => warning, Exceptions are thrown if read XML file is not valid
* @param newParameters : a parameters structures updated with the new target configuration
* @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error
*/
CV_WRAP virtual void setup(SegmentationParameters newParameters)=0;

Expand All @@ -152,7 +151,7 @@ class CV_EXPORTS_W TransientAreasSegmentationModule: public Algorithm

/**
* write xml/yml formated parameters information
* @rparam fs : the filename of the xml file that will be open and writen with formatted parameters information
* @param fs : the filename of the xml file that will be open and writen with formatted parameters information
*/
CV_WRAP virtual void write( String fs ) const=0;

Expand Down Expand Up @@ -181,9 +180,8 @@ class CV_EXPORTS_W TransientAreasSegmentationModule: public Algorithm
CV_WRAP virtual void clearAllBuffers()=0;
};

/**
* allocator
* @param Size : size of the images input to segment (output will be the same size)
/** allocator
* @param inputSize : size of the images input to segment (output will be the same size)
*/
CV_EXPORTS_W Ptr<TransientAreasSegmentationModule> createTransientAreasSegmentationModule(Size inputSize);

Expand Down
2 changes: 2 additions & 0 deletions modules/ccalib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Custom Calibration Pattern for 3D reconstruction
================================================
4 changes: 2 additions & 2 deletions modules/cvv/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CVVisual
========
GUI for Interactive Visual Debugging of Computer Vision Programs
================================================================
2 changes: 1 addition & 1 deletion modules/datasets/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(the_description "datasets framework")
ocv_define_module(datasets opencv_core opencv_face opencv_ml opencv_flann)
ocv_define_module(datasets opencv_core opencv_face opencv_ml opencv_flann opencv_text)

ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4267) # flann, Win64
Loading