Skip to content
Open
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
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
endif()

set (CMAKE_CXX_STANDARD 11)

if(BUILD_DUtils)
set(HDRS include/DUtils/
include/DUtils/BinaryFile.h include/DUtils/DUtils.h include/DUtils/FileModes.h include/DUtils/Math.hpp
Expand Down
45 changes: 23 additions & 22 deletions src/DUtilsCV/Drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
*/

#include <vector>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv/cv.h>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/calib3d.hpp>
#include "Drawing.h"

using namespace std;
Expand All @@ -23,11 +24,11 @@ void Drawing::drawKeyPoints(cv::Mat &image,
const std::vector<cv::KeyPoint> &keypoints,
bool colorOctave, bool useCartesianAngle)
{
CvScalar colors[4] = {
cvScalar(0, 0, 255),
cvScalar(0, 255, 0),
cvScalar(255, 0, 0),
cvScalar(255, 255, 255)
cv::Scalar colors[4] = {
cv::Scalar(0, 0, 255),
cv::Scalar(0, 255, 0),
cv::Scalar(255, 0, 0),
cv::Scalar(255, 255, 255)
};

const double PI = 3.14159265;
Expand All @@ -39,7 +40,7 @@ void Drawing::drawKeyPoints(cv::Mat &image,
float s = it->size / 2.f;
//if(s < 3.f) s = 3.f;

const CvScalar *color;
const cv::Scalar *color;
if(!colorOctave || it->octave < 1 || it->octave > 3)
color = &colors[3];
else
Expand All @@ -48,7 +49,7 @@ void Drawing::drawKeyPoints(cv::Mat &image,
int r1 = (int)(it->pt.y + 0.5);
int c1 = (int)(it->pt.x + 0.5);

cv::circle(image, cvPoint(c1, r1), (int)s, *color, 1);
cv::circle(image, cv::Point(c1, r1), (int)s, *color, 1);

if(it->angle >= 0)
{
Expand All @@ -62,7 +63,7 @@ void Drawing::drawKeyPoints(cv::Mat &image,
else
r2 = (int)(s * sin(o) + it->pt.y + 0.5);

cv::line(image, cvPoint(c1, r1), cvPoint(c2, r2), *color);
cv::line(image, cv::Point(c1, r1), cv::Point(c2, r2), *color);
}
}
}
Expand Down Expand Up @@ -102,12 +103,12 @@ void Drawing::drawCorrespondences(cv::Mat &image, const cv::Mat &img1,

cv::Mat aux1, aux2;
if(img1.channels() > 1)
cv::cvtColor(img1, aux1, CV_RGB2GRAY);
cv::cvtColor(img1, aux1, cv::COLOR_RGB2GRAY);
else
aux1 = img1.clone();

if(img2.channels() > 1)
cv::cvtColor(img2, aux2, CV_RGB2GRAY);
cv::cvtColor(img2, aux2, cv::COLOR_RGB2GRAY);
else
aux2 = img2.clone();

Expand Down Expand Up @@ -151,12 +152,12 @@ void Drawing::drawCorrespondences(cv::Mat &image, const cv::Mat &img1,

py += img1.rows;

CvScalar color = cvScalar(
cv::Scalar color = cv::Scalar(
int(((double)rand()/((double)RAND_MAX + 1.0)) * 256.0),
int(((double)rand()/((double)RAND_MAX + 1.0)) * 256.0),
int(((double)rand()/((double)RAND_MAX + 1.0)) * 256.0));

cv::line(image, cvPoint(mx, my), cvPoint(px, py), color, 1);
cv::line(image, cv::Point(mx, my), cv::Point(px, py), color, 1);
}
}

Expand Down Expand Up @@ -206,19 +207,19 @@ void Drawing::drawReferenceSystem(cv::Mat &image, const cv::Mat &cRo,
cv::projectPoints(cv::Mat(oP), cRo, cto, A, k, points2d);

// draw axis
CvScalar bluez, greeny, redx;
cv::Scalar bluez, greeny, redx;

if(image.channels() == 3 )
{
bluez = cvScalar(255,0,0);
greeny = cvScalar(0,255,0);
redx = cvScalar(0,0,255);
bluez = cv::Scalar(255,0,0);
greeny = cv::Scalar(0,255,0);
redx = cv::Scalar(0,0,255);
}
else
{
bluez = cvScalar(18,18,18);
greeny = cvScalar(182,182,182);
redx = cvScalar(120,120,120);
bluez = cv::Scalar(18,18,18);
greeny = cv::Scalar(182,182,182);
redx = cv::Scalar(120,120,120);
}

cv::line(image, points2d[0], points2d[1], redx, 2);
Expand Down
37 changes: 20 additions & 17 deletions src/DUtilsCV/GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@

#include <vector>
#include <queue>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

#include <opencv/highgui.h>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>

#include <cstdio>
#include <string>
#include <sstream>
Expand All @@ -39,7 +42,7 @@ int GUI::showImage(const cv::Mat &image, bool autosize,
name = ssname.str();

int flags = 0;
if(autosize) flags |= CV_WINDOW_AUTOSIZE;
if(autosize) flags |= cv::WINDOW_AUTOSIZE;

cv::namedWindow( name.c_str(), flags );

Expand Down Expand Up @@ -81,7 +84,7 @@ int GUI::showImageInfo(const cv::Mat &image, bool autosize,
tWinHandler *hwnd = (_hwnd ? _hwnd : &haux);

if(image.type() == CV_8U)
cv::cvtColor(image, image_rgb, CV_GRAY2RGB);
cv::cvtColor(image, image_rgb, cv::COLOR_GRAY2RGB);
else
image_rgb = image;

Expand Down Expand Up @@ -237,7 +240,7 @@ void GUI::MouseHandler::attach(const tWinHandler &hwnd,
void GUI::MouseHandler::attachToClicks(const tWinHandler &hwnd)
{
m_valid_events.resize(1);
m_valid_events[0] = CV_EVENT_LBUTTONUP;
m_valid_events[0] = cv::EVENT_LBUTTONUP;
m_attached = true;
cv::setMouseCallback(hwnd, GUI::MouseHandler::callbackHandlerFunction, this);
}
Expand All @@ -247,7 +250,7 @@ void GUI::MouseHandler::attachToClicks(const tWinHandler &hwnd)
void GUI::MouseHandler::attachToMotions(const tWinHandler &hwnd)
{
m_valid_events.resize(1);
m_valid_events[0] = CV_EVENT_MOUSEMOVE;
m_valid_events[0] = cv::EVENT_MOUSEMOVE;
m_attached = true;
cv::setMouseCallback(hwnd, GUI::MouseHandler::callbackHandlerFunction, this);
}
Expand Down Expand Up @@ -275,16 +278,16 @@ void GUI::MouseHandler::listenToAll()
//@note RACE CONDITION!

m_valid_events.resize(10);
m_valid_events[0] = CV_EVENT_LBUTTONDOWN;
m_valid_events[1] = CV_EVENT_LBUTTONUP;
m_valid_events[2] = CV_EVENT_LBUTTONDBLCLK;
m_valid_events[3] = CV_EVENT_RBUTTONDOWN;
m_valid_events[4] = CV_EVENT_RBUTTONUP;
m_valid_events[5] = CV_EVENT_RBUTTONDBLCLK;
m_valid_events[6] = CV_EVENT_MBUTTONDOWN;
m_valid_events[7] = CV_EVENT_MBUTTONUP;
m_valid_events[8] = CV_EVENT_MBUTTONDBLCLK;
m_valid_events[9] = CV_EVENT_MOUSEMOVE;
m_valid_events[0] = cv::EVENT_LBUTTONDOWN;
m_valid_events[1] = cv::EVENT_LBUTTONUP;
m_valid_events[2] = cv::EVENT_LBUTTONDBLCLK;
m_valid_events[3] = cv::EVENT_RBUTTONDOWN;
m_valid_events[4] = cv::EVENT_RBUTTONUP;
m_valid_events[5] = cv::EVENT_RBUTTONDBLCLK;
m_valid_events[6] = cv::EVENT_MBUTTONDOWN;
m_valid_events[7] = cv::EVENT_MBUTTONUP;
m_valid_events[8] = cv::EVENT_MBUTTONDBLCLK;
m_valid_events[9] = cv::EVENT_MOUSEMOVE;

std::sort(m_valid_events.begin(), m_valid_events.end());
}
Expand Down
2 changes: 1 addition & 1 deletion src/DVision/BRIEF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void BRIEF::compute(const cv::Mat &image,
cv::Mat aux;
if(image.depth() == 3)
{
cv::cvtColor(image, aux, CV_RGB2GRAY);
cv::cvtColor(image, aux, cv::COLOR_RGB2GRAY);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/DVision/FSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ cv::Mat FSolver::findFundamentalMat(const cv::Mat &P1, const cv::Mat &P2,
cv::Mat sq_ab, norms;
cv::multiply(l1.rowRange(0,2), l1.rowRange(0,2), sq_ab);

cv::reduce(sq_ab, norms, 0, CV_REDUCE_SUM); // 0 = single row
cv::reduce(sq_ab, norms, 0, cv::REDUCE_SUM); // 0 = single row
cv::sqrt(norms, norms); // norms is Nx2

cv::Mat thresholds = norms * reprojection_error; // Nx1
Expand All @@ -157,7 +157,7 @@ cv::Mat FSolver::findFundamentalMat(const cv::Mat &P1, const cv::Mat &P2,
// d(x, l) = dot(x*, l*), * means normalized
cv::Mat prod, dot;
cv::multiply(l1, Q1, prod); // l1 against Q1 (homogeneous in image coords)
cv::reduce(prod, dot, 0, CV_REDUCE_SUM); // dot is Nx1
cv::reduce(prod, dot, 0, cv::REDUCE_SUM); // dot is Nx1

// error w/o sign
dot = abs(dot);
Expand Down
2 changes: 1 addition & 1 deletion src/DVision/HSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ cv::Mat HSolver::findHomography(const cv::Mat &P1, const cv::Mat &P2,
cv::multiply(ab, ab, sq_ab);

cv::Mat error;
cv::reduce(sq_ab, error, 0, CV_REDUCE_SUM); // 0 = single row
cv::reduce(sq_ab, error, 0, cv::REDUCE_SUM); // 0 = single row
// squared error is positive

// get inliers
Expand Down