Permalink
Browse files

Switch to OpenCV 4.0

Might still work with older versions, but unclear when the new flag enums
were introduced into OpenCV.
  • Loading branch information...
ypnos committed Dec 18, 2018
1 parent a62f450 commit 9087648d599690dc32c75e52ad1b011cf99687d1
@@ -2,7 +2,7 @@ ABOUT
-----

This archive contains the Software "gerbil" maintained by Johannes Jordan
<johannes.jordan@informatik.uni-erlangen.de> at the Pattern Recognition Lab,
<johannes.jordan@cs.fau.de> at the Pattern Recognition Lab,
University of Erlangen-Nuremberg. See the file AUTHORS for a list of all
contributors.

@@ -1,7 +1,7 @@
# Library versions

# 2.4 introduces some new features we use and older versions are buggy, too!
set(VOLE_MINIMUM_OPENCV_VERSION "2.4.0")
# We only tested 4.0 after making changes to stay compatible with 4.0
set(VOLE_MINIMUM_OPENCV_VERSION "4.0.0")

# 5.5 or 5.5.1 fixes an important drawing bug
set(VOLE_MINIMUM_QT_VERSION "5.5.1")
@@ -17,7 +17,7 @@ bool PcaTbb::run()
tbb::parallel_for(tbb::blocked_range<size_t>(0, (*source)->size()),
computePixels, tbb::auto_partitioner(), stopper);

cv::PCA pca(pixels, cv::noArray(), CV_PCA_DATA_AS_COL, (int)components);
cv::PCA pca(pixels, cv::noArray(), cv::PCA::DATA_AS_COL, (int)components);

multi_img *target = new multi_img(
(*source)->height, (*source)->width, pca.eigenvectors.rows);
@@ -290,7 +290,7 @@ std::vector<cv::Vec3b> Labeling::colors(int count, bool yellowcursor,
hsvmap[0][i] = cv::Vec3f(hue, 1.f, val);
hue += distance;
}
cv::cvtColor(hsvmap, hsvmap, CV_HSV2BGR);
cv::cvtColor(hsvmap, hsvmap, cv::COLOR_HSV2BGR);

// save in ret vector (build matrix around vector to avoid a copy)
ret.resize(count);
@@ -389,8 +389,7 @@ cv::PCA multi_img::pca(unsigned int components) const
}

// perform PCA
cv::PCA ret(input, cv::noArray(), CV_PCA_DATA_AS_COL, (int)components);
return ret;
return {input, cv::noArray(), cv::PCA::DATA_AS_COL, (int)components};
}

multi_img multi_img::project(const cv::PCA &pca) const
@@ -176,7 +176,7 @@ void multi_img::write_out(const std::string& base,

// parameters to image writer
std::vector<int> flags;
flags.push_back(CV_IMWRITE_PNG_COMPRESSION);
flags.push_back(cv::IMWRITE_PNG_COMPRESSION);
flags.push_back(9); // [0-9] 9 being max compression, default is 3

// write out band files and corresponding text file entries at once
@@ -120,7 +120,7 @@ void GerbilApplication::init_opencv()
cv::subtract(b1, b1, b2);
cv::multiply(b1, b1, b2);
cv::divide(b1, b1, b2);
cv::PCA pca(b1, cv::noArray(), CV_PCA_DATA_AS_COL, 0);
cv::PCA pca(b1, cv::noArray(), cv::PCA::DATA_AS_COL, 0);
pca.project(b1, b2);
}

@@ -113,7 +113,7 @@ class ComputeIconMasks {

// transform mask into icon
cv::Mat1b masktrf = cv::Mat1b::zeros(iconSizecv);
cv::warpAffine(mask, masktrf, trafo, iconSizecv, CV_INTER_AREA);
cv::warpAffine(mask, masktrf, trafo, iconSizecv, cv::INTER_AREA);

if(tbb::task::self().is_cancelled()) {
//GGDBGM("aborted through tbb cancel." << endl);
@@ -34,7 +34,7 @@ int GraphSegShell::execute() {

// Read the seed image
cv::Mat1b seeds;
seeds = cv::imread(config.seed_file, CV_LOAD_IMAGE_GRAYSCALE);
seeds = cv::imread(config.seed_file, cv::IMREAD_GRAYSCALE);
if (seeds.empty()) {
std::cerr << "ERROR: Could not load seed file: "
<< config.seed_file << std::endl;

0 comments on commit 9087648

Please sign in to comment.