fixed logging function in opencv_stitching
This commit is contained in:
parent
8191b5564f
commit
aa3e481458
@ -38,78 +38,78 @@
|
|||||||
// or tort (including negligence or otherwise) arising in any way out of
|
// or tort (including negligence or otherwise) arising in any way out of
|
||||||
// the use of this software, even if advised of the possibility of such damage.
|
// the use of this software, even if advised of the possibility of such damage.
|
||||||
//
|
//
|
||||||
//M*/
|
//M*/
|
||||||
#ifndef __OPENCV_STITCHING_UTIL_HPP__
|
#ifndef __OPENCV_STITCHING_UTIL_HPP__
|
||||||
#define __OPENCV_STITCHING_UTIL_HPP__
|
#define __OPENCV_STITCHING_UTIL_HPP__
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
|
|
||||||
#define ENABLE_LOG 1
|
#define ENABLE_LOG 1
|
||||||
|
|
||||||
#if ENABLE_LOG
|
#if ENABLE_LOG
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#define LOG(msg) std::cout << msg;
|
#define LOG(msg) { std::cout << msg; std::cout.flush(); }
|
||||||
#else
|
#else
|
||||||
#define LOG(msg)
|
#define LOG(msg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LOGLN(msg) LOG(msg << std::endl)
|
#define LOGLN(msg) LOG(msg << std::endl)
|
||||||
|
|
||||||
|
|
||||||
class DjSets
|
class DjSets
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DjSets(int n = 0) { create(n); }
|
DjSets(int n = 0) { create(n); }
|
||||||
|
|
||||||
void create(int n);
|
void create(int n);
|
||||||
int find(int elem);
|
int find(int elem);
|
||||||
int merge(int set1, int set2);
|
int merge(int set1, int set2);
|
||||||
|
|
||||||
std::vector<int> parent;
|
std::vector<int> parent;
|
||||||
std::vector<int> size;
|
std::vector<int> size;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<int> rank_;
|
std::vector<int> rank_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct GraphEdge
|
struct GraphEdge
|
||||||
{
|
{
|
||||||
GraphEdge(int from, int to, float weight)
|
GraphEdge(int from, int to, float weight)
|
||||||
: from(from), to(to), weight(weight) {}
|
: from(from), to(to), weight(weight) {}
|
||||||
bool operator <(const GraphEdge& other) const { return weight < other.weight; }
|
bool operator <(const GraphEdge& other) const { return weight < other.weight; }
|
||||||
bool operator >(const GraphEdge& other) const { return weight > other.weight; }
|
bool operator >(const GraphEdge& other) const { return weight > other.weight; }
|
||||||
|
|
||||||
int from, to;
|
int from, to;
|
||||||
float weight;
|
float weight;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Graph
|
class Graph
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Graph(int num_vertices = 0) { create(num_vertices); }
|
Graph(int num_vertices = 0) { create(num_vertices); }
|
||||||
void create(int num_vertices) { edges_.assign(num_vertices, std::list<GraphEdge>()); }
|
void create(int num_vertices) { edges_.assign(num_vertices, std::list<GraphEdge>()); }
|
||||||
int numVertices() const { return static_cast<int>(edges_.size()); }
|
int numVertices() const { return static_cast<int>(edges_.size()); }
|
||||||
void addEdge(int from, int to, float weight);
|
void addEdge(int from, int to, float weight);
|
||||||
template <typename B> B forEach(B body) const;
|
template <typename B> B forEach(B body) const;
|
||||||
template <typename B> B walkBreadthFirst(int from, B body) const;
|
template <typename B> B walkBreadthFirst(int from, B body) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector< std::list<GraphEdge> > edges_;
|
std::vector< std::list<GraphEdge> > edges_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Auxiliary functions
|
// Auxiliary functions
|
||||||
|
|
||||||
bool overlapRoi(cv::Point tl1, cv::Point tl2, cv::Size sz1, cv::Size sz2, cv::Rect &roi);
|
bool overlapRoi(cv::Point tl1, cv::Point tl2, cv::Size sz1, cv::Size sz2, cv::Rect &roi);
|
||||||
cv::Rect resultRoi(const std::vector<cv::Point> &corners, const std::vector<cv::Mat> &images);
|
cv::Rect resultRoi(const std::vector<cv::Point> &corners, const std::vector<cv::Mat> &images);
|
||||||
cv::Rect resultRoi(const std::vector<cv::Point> &corners, const std::vector<cv::Size> &sizes);
|
cv::Rect resultRoi(const std::vector<cv::Point> &corners, const std::vector<cv::Size> &sizes);
|
||||||
cv::Point resultTl(const std::vector<cv::Point> &corners);
|
cv::Point resultTl(const std::vector<cv::Point> &corners);
|
||||||
|
|
||||||
|
|
||||||
#include "util_inl.hpp"
|
#include "util_inl.hpp"
|
||||||
|
|
||||||
#endif // __OPENCV_STITCHING_UTIL_HPP__
|
#endif // __OPENCV_STITCHING_UTIL_HPP__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user