Commit 0bd061f0 authored by Maksim Shabunin's avatar Maksim Shabunin

Merge pull request #1413 from alalek:fix_build

parents e9cd99d9 27ced2cb
set(BUILD_opencv_cnn_3dobj_INIT OFF) # Must be disabled by default - requires custom build of Caffe.
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
find_package(Caffe)
......@@ -8,7 +10,9 @@ else()
message(STATUS "Caffe: NO")
endif()
find_package(Protobuf)
if(NOT BUILD_PROTOBUF)
find_package(Protobuf)
endif()
if(Protobuf_FOUND)
message(STATUS "Protobuf: YES")
set(HAVE_PROTOBUF 1)
......
# Protobuf package for CNN Triplet training
unset(Protobuf_FOUND)
find_library(Protobuf_LIBS NAMES protobuf
HINTS
/usr/local/lib)
if(Protobuf_LIBS)
set(Protobuf_FOUND 1)
endif()
......@@ -58,18 +58,10 @@ struct CallMetaData
} // namespaces
#ifdef __GNUC__
#define CVVISUAL_FUNCTION_NAME_MACRO __PRETTY_FUNCTION__
#else
#define CVVISUAL_FUNCTION_NAME_MACRO __func__
#endif
/**
* @brief Creates an instance of CallMetaData with the location of the macro as
* value.
*/
#define CVVISUAL_LOCATION \
::cvv::impl::CallMetaData(__FILE__, __LINE__, \
CVVISUAL_FUNCTION_NAME_MACRO)
#define CVVISUAL_LOCATION ::cvv::impl::CallMetaData(__FILE__, __LINE__, CV_Func)
#endif
......@@ -67,14 +67,14 @@ void changedPixelImage(const cv::Mat& mat0, const cv::Mat& mat1, cv::Mat& out)
template<int Depth, int Channels>
void changedPixelImage(const cv::Mat& mat0, const cv::Mat& mat1, cv::Mat& out)
{
using PixelInType=const cvv::qtutil::PixelType<Depth,Channels>;
using PixelInType=cvv::qtutil::PixelType<Depth,Channels>;
using PixelOutType=cvv::qtutil::DepthType<CV_8U>;
cv::Mat result=cv::Mat::zeros(mat0.rows, mat0.cols,CV_8U);
bool same;
PixelInType* in0;
PixelInType* in1;
const PixelInType* in0;
const PixelInType* in1;
for(int i=0;i<result.rows;i++)
{
for(int j=0;j<result.cols;j++)
......
......@@ -12,7 +12,7 @@ TEST(LocationTest, FileLineFunction)
auto locationMacroResult = CVVISUAL_LOCATION;
size_t line = __LINE__ - 1;
auto file = __FILE__;
auto fun = CVVISUAL_FUNCTION_NAME_MACRO;
auto fun = CV_Func;
EXPECT_EQ(locationMacroResult.isKnown, true);
EXPECT_EQ(locationMacroResult.file, file);
EXPECT_EQ(locationMacroResult.line, line);
......
......@@ -79,7 +79,9 @@ add_definitions(-DCNN_NO_SERIALIZATION -DCNN_USE_CAFFE_CONVERTER)
# NOTE: In case that proto files already exist,
# this is not needed anymore.
find_package(Protobuf QUIET)
if(NOT BUILD_PROTOBUF)
find_package(Protobuf QUIET)
endif()
if(NOT ${Protobuf_FOUND})
message(STATUS "Module opencv_dnn_modern disabled because Protobuf is not found")
......
......@@ -121,7 +121,7 @@ Mat loadPLYSimple(const char* fileName, int withNormals)
{
float* data = cloud.ptr<float>(i);
int col = 0;
for (; col < withNormals ? 6 : 3; ++col)
for (; col < (withNormals ? 6 : 3); ++col)
{
ifs >> data[col];
}
......
......@@ -64,7 +64,7 @@ size_t hash( unsigned int a)
hashtable_int *hashtableCreate(size_t size, size_t (*hashfunc)(unsigned int))
{
hashtable_int *hashtbl;
if (size < 16)
{
size = 16;
......@@ -73,25 +73,25 @@ hashtable_int *hashtableCreate(size_t size, size_t (*hashfunc)(unsigned int))
{
size = (size_t)next_power_of_two((unsigned int)size);
}
hashtbl=(hashtable_int*)malloc(sizeof(hashtable_int));
hashtbl=(hashtable_int*)malloc(sizeof(hashtable_int));
if (!hashtbl)
return NULL;
hashtbl->nodes=(hashnode_i**)calloc(size, sizeof(struct hashnode_i*));
hashtbl->nodes=(hashnode_i**)calloc(size, sizeof(struct hashnode_i*));
if (!hashtbl->nodes)
{
free(hashtbl);
return NULL;
}
hashtbl->size=size;
if (hashfunc)
hashtbl->hashfunc=hashfunc;
else
hashtbl->hashfunc=hash;
return hashtbl;
}
......@@ -100,7 +100,7 @@ void hashtableDestroy(hashtable_int *hashtbl)
{
size_t n;
struct hashnode_i *node, *oldnode;
for (n=0; n<hashtbl->size; ++n)
{
node=hashtbl->nodes[n];
......@@ -120,10 +120,10 @@ int hashtableInsert(hashtable_int *hashtbl, KeyType key, void *data)
{
struct hashnode_i *node;
size_t hash=hashtbl->hashfunc(key)%hashtbl->size;
/* fpruintf(stderr, "hashtbl_insert() key=%s, hash=%d, data=%s\n", key, hash, (char*)data);*/
node=hashtbl->nodes[hash];
while (node)
{
......@@ -134,18 +134,18 @@ int hashtableInsert(hashtable_int *hashtbl, KeyType key, void *data)
}
node=node->next;
}
node=(hashnode_i*)malloc(sizeof(struct hashnode_i));
node=(hashnode_i*)malloc(sizeof(struct hashnode_i));
if (!node)
return -1;
node->key=key;
node->data=data;
node->next=hashtbl->nodes[hash];
hashtbl->nodes[hash]=node;
return 0;
}
......@@ -153,10 +153,10 @@ int hashtableInsertHashed(hashtable_int *hashtbl, KeyType key, void *data)
{
struct hashnode_i *node;
size_t hash = key % hashtbl->size;
/* fpruintf(stderr, "hashtbl_insert() key=%s, hash=%d, data=%s\n", key, hash, (char*)data);*/
node=hashtbl->nodes[hash];
while (node)
{
......@@ -167,18 +167,18 @@ int hashtableInsertHashed(hashtable_int *hashtbl, KeyType key, void *data)
}
node=node->next;
}
node=(hashnode_i*)malloc(sizeof(struct hashnode_i));
node=(hashnode_i*)malloc(sizeof(struct hashnode_i));
if (!node)
return -1;
node->key=key;
node->data=data;
node->next=hashtbl->nodes[hash];
hashtbl->nodes[hash]=node;
return 0;
}
......@@ -187,7 +187,7 @@ int hashtableRemove(hashtable_int *hashtbl, KeyType key)
{
struct hashnode_i *node, *prevnode=NULL;
size_t hash=hashtbl->hashfunc(key)%hashtbl->size;
node=hashtbl->nodes[hash];
while (node)
{
......@@ -203,7 +203,7 @@ int hashtableRemove(hashtable_int *hashtbl, KeyType key)
prevnode=node;
node=node->next;
}
return -1;
}
......@@ -212,9 +212,9 @@ void *hashtableGet(hashtable_int *hashtbl, KeyType key)
{
struct hashnode_i *node;
size_t hash=hashtbl->hashfunc(key)%hashtbl->size;
/* fprintf(stderr, "hashtbl_get() key=%s, hash=%d\n", key, hash);*/
node=hashtbl->nodes[hash];
while (node)
{
......@@ -222,14 +222,14 @@ void *hashtableGet(hashtable_int *hashtbl, KeyType key)
return node->data;
node=node->next;
}
return NULL;
}
hashnode_i* hashtableGetBucketHashed(hashtable_int *hashtbl, KeyType key)
{
size_t hash = key % hashtbl->size;
return hashtbl->nodes[hash];
}
......@@ -238,14 +238,14 @@ int hashtableResize(hashtable_int *hashtbl, size_t size)
hashtable_int newtbl;
size_t n;
struct hashnode_i *node,*next;
newtbl.size=size;
newtbl.hashfunc=hashtbl->hashfunc;
newtbl.nodes=(hashnode_i**)calloc(size, sizeof(struct hashnode_i*));
newtbl.nodes=(hashnode_i**)calloc(size, sizeof(struct hashnode_i*));
if (!newtbl.nodes)
return -1;
for (n=0; n<hashtbl->size; ++n)
{
for (node=hashtbl->nodes[n]; node; node=next)
......@@ -253,14 +253,14 @@ int hashtableResize(hashtable_int *hashtbl, size_t size)
next = node->next;
hashtableInsert(&newtbl, node->key, node->data);
hashtableRemove(hashtbl, node->key);
}
}
free(hashtbl->nodes);
hashtbl->size=newtbl.size;
hashtbl->nodes=newtbl.nodes;
return 0;
}
......@@ -270,24 +270,24 @@ int hashtableWrite(const hashtable_int * hashtbl, const size_t dataSize, FILE* f
size_t hashMagic=T_HASH_MAGIC;
size_t n=hashtbl->size;
size_t i;
fwrite(&hashMagic, sizeof(size_t),1, f);
fwrite(&n, sizeof(size_t),1, f);
fwrite(&dataSize, sizeof(size_t),1, f);
for (i=0; i<hashtbl->size; i++)
{
struct hashnode_i* node=hashtbl->nodes[i];
size_t noEl=0;
while (node)
{
noEl++;
node=node->next;
}
fwrite(&noEl, sizeof(size_t),1, f);
node=hashtbl->nodes[i];
while (node)
{
......@@ -296,7 +296,7 @@ int hashtableWrite(const hashtable_int * hashtbl, const size_t dataSize, FILE* f
node=node->next;
}
}
return 1;
}
......@@ -305,13 +305,13 @@ void hashtablePrint(hashtable_int *hashtbl)
{
size_t n;
struct hashnode_i *node,*next;
for (n=0; n<hashtbl->size; ++n)
{
for (node=hashtbl->nodes[n]; node; node=next)
{
next = node->next;
std::cout<<"Key : "<<node->key<<", Data : "<<node->data<<std::endl;
std::cout<<"Key : "<<node->key<<", Data : "<<node->data<<std::endl;
}
}
}
......@@ -321,7 +321,7 @@ hashtable_int *hashtableRead(FILE* f)
size_t hashMagic = 0;
size_t n = 0, status;
hashtable_int *hashtbl = 0;
status = fread(&hashMagic, sizeof(size_t),1, f);
if (status && hashMagic==T_HASH_MAGIC)
{
......@@ -329,20 +329,20 @@ hashtable_int *hashtableRead(FILE* f)
size_t dataSize;
status = fread(&n, sizeof(size_t),1, f);
status = fread(&dataSize, sizeof(size_t),1, f);
hashtbl=hashtableCreate(n, hash);
for (i=0; i<hashtbl->size; i++)
{
size_t j=0;
status = fread(&n, sizeof(size_t),1, f);
for (j=0; j<n; j++)
{
int key=0;
void* data=0;
status = fread(&key, sizeof(KeyType), 1, f);
if (dataSize>sizeof(void*))
{
data=malloc(dataSize);
......@@ -355,7 +355,7 @@ hashtable_int *hashtableRead(FILE* f)
}
else
status = fread(&data, dataSize, 1, f);
hashtableInsert(hashtbl, key, data);
//free(key);
}
......@@ -363,7 +363,7 @@ hashtable_int *hashtableRead(FILE* f)
}
else
return 0;
return hashtbl;
}
......
......@@ -83,7 +83,9 @@ private:
Rect2d vote(const std::vector<Point2f>& oldPoints,const std::vector<Point2f>& newPoints,const Rect2d& oldRect,Point2f& mD);
float dist(Point2f p1,Point2f p2);
std::string type2str(int type);
#if 0
void computeStatistics(std::vector<float>& data,int size=-1);
#endif
void check_FB(const std::vector<Mat>& oldImagePyr,const std::vector<Mat>& newImagePyr,
const std::vector<Point2f>& oldPoints,const std::vector<Point2f>& newPoints,std::vector<bool>& status);
void check_NCC(const Mat& oldImage,const Mat& newImage,
......@@ -337,6 +339,7 @@ Rect2d TrackerMedianFlowImpl::vote(const std::vector<Point2f>& oldPoints,const s
return newRect;
}
#if 0
void TrackerMedianFlowImpl::computeStatistics(std::vector<float>& data,int size){
int binnum=10;
if(size==-1){
......@@ -351,6 +354,7 @@ void TrackerMedianFlowImpl::computeStatistics(std::vector<float>& data,int size)
dprintf(("[%4f,%4f] -- %4d\n",mini+(maxi-mini)/binnum*i,mini+(maxi-mini)/binnum*(i+1),bins[i]));
}
}
#endif
void TrackerMedianFlowImpl::check_FB(const std::vector<Mat>& oldImagePyr, const std::vector<Mat>& newImagePyr,
const std::vector<Point2f>& oldPoints, const std::vector<Point2f>& newPoints, std::vector<bool>& status){
......
......@@ -93,8 +93,10 @@ inline int smoothedSum(const Mat& sum, const KeyPoint& pt, int y, int x, bool us
{
int rx = (int)(((float)x)*R(1,0) - ((float)y)*R(0,0));
int ry = (int)(((float)x)*R(0,0) + ((float)y)*R(1,0));
if (rx > 24) rx = 24; if (rx < -24) rx = -24;
if (ry > 24) ry = 24; if (ry < -24) ry = -24;
if (rx > 24) rx = 24;
if (rx < -24) rx = -24;
if (ry > 24) ry = 24;
if (ry < -24) ry = -24;
x = rx; y = ry;
}
const int img_y = (int)(pt.pt.y + 0.5) + y;
......
......@@ -23,7 +23,6 @@ protected:
std::vector<Mat> layers;
Octave(std::vector<Mat> layers);
virtual ~Octave();
std::vector<Mat> getLayers();
Mat getLayerAt(int i);
};
......@@ -278,14 +277,6 @@ void Pyramid::Params::clear()
*/
Pyramid::Octave::Octave(std::vector<Mat> _layers) : layers(_layers) {}
/**
* Return layers of the Octave
*/
std::vector<Mat> Pyramid::Octave::getLayers()
{
return layers;
}
/**
* Return the Octave's layer at index i
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment