I'd suggest to move all the stuff into single header barcode1d.hpp. Also, there should be barcode.hpp (the header with the same name as module) which should include barcode1d.hpp. All the headers should be put into opencv2 subdirectory of include directory. That is, there should be modules/barcode/include/opencv2/barcode.hpp and modules/barcode/include/opencv2/barcode/barcode1d.hpp.