How to contribute an optimised LineSegmentDetector Algorithm? [closed]
Hello,
colleagues of mine implemented this optimised LSD in a seperate project and we want to contribute an this version of the LineSegmentDetector algorithm back to the community. I'm in charge to bring this version of the Algorithm back into the OpenCV Repository via a PullRequest. I started with http://code.opencv.org/projects/openc... and cloned the repository in order to add the hopefully optimised Algorithm.
But i ran into Problems while trying to add the "new" LSD-Algorithm into the module "imgproc" where the "old" one resides. The new Algorithm needs to be compiled with "-std=c++11", but the OpenCV project isn't. That's because i'm running into errors.
In my Sandbox the files containing the optimised Algorithm are compiled as follows:
project( lsd_back_newImpl CXX )
cmake_minimum_required(VERSION 2.8)
set (CMAKE_CXX_COMPILER "g++")
set( CMAKE_CXX_FLAGS "-std=c++11 -Wall -pthread -Os -s" )
add_library( lsd_back_newImpl SHARED lsd_back_newImpl )
set_target_properties( lsd_back_newImpl PROPERTIES LINKER_LANGUAGE CXX )
This way i get a shared library that i could probably use from the opencv library compiled without -std=C++11.
In first place, i put the lsd_new.cpp into the modules/imgproc/src directory. If i put the lsd_back_newImpl.cpp to modules/imgproc/src it will be automatically compiled, but without the compile flag "-std=C++11".
The CMakeLists.txt of modules/imgproc "only" contains
set(the_description "Image Processing")
ocv_define_module(imgproc opencv_core WRAP java python)
How would i accomplish to compile all files in imgproc/* like before, except the lsd_new.cpp file and instead compiling this file with the different Compiler_Flags in order to add a shared library that is compiled with the required flags?
oh, nice, new contributions ;)
(i'm not one of the devs there, but let me tell, what i've seen)
(in general, the devs there seem to be quite hesitant to accept c++11 code at all. are there ways to avoid it ?)
Oh, didn't know about the OpenCV_contrib Repo. Thanks for that Info. I'll look there of course then.
I'll examine this Repo and try to add it there. Thanks again.
Hello @_Christian_ I am not sure how, but a couple of months ago I saw someone adding the possibility to enable C++11 standard in OpenCV in some PR. So if you create a seperate module, it might be possible to select the C++11 standard as a prerequisite for the model. @mshabunin do you maybe have any insights on this matter? ALSO big thumbs up for you guys contributing updated versions of algorithms!
I've discovered that cvv module is compiled with C++11 enabled but it also depends on Qt5 and is quite rarely used.
Please note that it is not a good idea to vary library interface depending on compiler flags. Probably you can add new algorithm to ximgproc module in opencv_contrib repository with fallback to current implementation in case when C++11 was not enabled, but this way might need new option to be added to cmake scripts. We will discuss this question in nearest future.
Hello _Christian_, I was wondering if by any chance you adapted your solution for the LineSegmentDetector in Python. Thank u !