Commit a2eae86c authored by Alexander Alekhin's avatar Alexander Alekhin

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

parents 99573cb9 8849e078
......@@ -103,7 +103,7 @@ protected:
// This function randomly generates test splits to get the best split.
splitr getTestSplits(std::vector<Point2f> pixel_coordinates,int seed);
// This function writes a split node to the XML file storing the trained model
void writeSplit(std::ofstream& os,const splitr split);
void writeSplit(std::ofstream& os, const splitr& split);
// This function writes a leaf node to the binary file storing the trained model
void writeLeaf(std::ofstream& os, const std::vector<Point2f> &leaf);
// This function writes a tree to the binary file containing the model
......
......@@ -26,7 +26,12 @@ bool FacemarkKazemiImpl :: findNearestLandmarks( vector< vector<int> >& nearest)
}
void FacemarkKazemiImpl :: readSplit(ifstream& is, splitr &vec)
{
is.read((char*)&vec, sizeof(splitr));
is.read((char*)&vec.index1, sizeof(vec.index1));
is.read((char*)&vec.index2, sizeof(vec.index2));
is.read((char*)&vec.thresh, sizeof(vec.thresh));
uint32_t dummy_ = 0;
is.read((char*)&dummy_, sizeof(dummy_)); // buggy writer structure alignment
CV_CheckEQ((int)(sizeof(vec.index1) + sizeof(vec.index2) + sizeof(vec.thresh) + sizeof(dummy_)), 24, "Invalid build configuration");
}
void FacemarkKazemiImpl :: readLeaf(ifstream& is, vector<Point2f> &leaf)
{
......
......@@ -219,9 +219,15 @@ void FacemarkKazemiImpl :: writeLeaf(ofstream& os, const vector<Point2f> &leaf)
os.write((char*)&size, sizeof(size));
os.write((char*)&leaf[0], leaf.size() * sizeof(Point2f));
}
void FacemarkKazemiImpl :: writeSplit(ofstream& os, splitr split)
void FacemarkKazemiImpl :: writeSplit(ofstream& os, const splitr& vec)
{
os.write((char*)&split, sizeof(split));
os.write((char*)&vec.index1, sizeof(vec.index1));
os.write((char*)&vec.index2, sizeof(vec.index2));
os.write((char*)&vec.thresh, sizeof(vec.thresh));
uint32_t dummy_ = 0;
os.write((char*)&dummy_, sizeof(dummy_)); // buggy original writer structure alignment
CV_CheckEQ((int)(sizeof(vec.index1) + sizeof(vec.index2) + sizeof(vec.thresh) + sizeof(dummy_)), 24, "Invalid build configuration");
}
void FacemarkKazemiImpl :: writeTree(ofstream &f,regtree tree)
{
......
......@@ -359,18 +359,26 @@ public:
void setCompositors(const std::vector<String>& names)
{
Viewport* vp = frameSrc->getViewport(0);
CompositorManager& cm = CompositorManager::getSingleton();
// this should be applied to all owned render targets
Ogre::RenderTarget* targets[] = {frameSrc, rWin, depthRTT};
cm.removeCompositorChain(vp); // remove previous configuration
for(size_t i = 0; i < names.size(); i++)
for(int j = 0; j < 3; j++)
{
if (!cm.addCompositor(vp, names[i])) {
LogManager::getSingleton().logError("Failed to add compositor: " + names[i]);
continue;
Ogre::RenderTarget* tgt = targets[j];
if(!tgt || (frameSrc == rWin && tgt == rWin)) continue;
Viewport* vp = tgt->getViewport(0);
cm.removeCompositorChain(vp); // remove previous configuration
for(size_t i = 0; i < names.size(); i++)
{
if (!cm.addCompositor(vp, names[i])) {
LogManager::getSingleton().logError("Failed to add compositor: " + names[i]);
continue;
}
cm.setCompositorEnabled(vp, names[i], true);
}
cm.setCompositorEnabled(vp, names[i], true);
}
}
......
......@@ -4,6 +4,8 @@
// This code is also subject to the license terms in the LICENSE_WillowGarage.md file found in this module's directory
#define CV__ENABLE_C_API_CTORS // enable C API ctors (must be removed)
#include <opencv2/core.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/imgproc/imgproc_c.h> // cvFindContours
......
......@@ -847,7 +847,7 @@ struct SURFInvoker : ParallelLoopBody
// unit vector is essential for contrast invariance
vec = descriptors->ptr<float>(k);
float scale = (float)(1./(std::sqrt(square_mag) + DBL_EPSILON));
float scale = (float)(1./(std::sqrt(square_mag) + FLT_EPSILON));
for( kk = 0; kk < dsize; kk++ )
vec[kk] *= scale;
}
......
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