Fixed mingw build.

This commit is contained in:
Andrey Kamaev
2012-06-08 03:15:08 +00:00
parent bee982b492
commit f62028dc16
41 changed files with 624 additions and 585 deletions

View File

@@ -252,7 +252,7 @@ bool cv::find4QuadCornerSubpix(InputArray _img, InputOutputArray _corners, Size
int black_thresh = histQuantile(hist, 0.45f);
int white_thresh = histQuantile(hist, 0.55f);
#else
int black_thresh, white_thresh;
int black_thresh = 0, white_thresh = 0;
segment_hist_max(hist, black_thresh, white_thresh);
#endif

View File

@@ -74,7 +74,7 @@
namespace cv
{
Retina::Retina(const cv::Size inputSize)
{
_retinaFilter = 0;
@@ -94,19 +94,19 @@ Retina::~Retina()
}
/**
* retreive retina input buffer size
* retreive retina input buffer size
*/
Size Retina::inputSize(){return cv::Size(_retinaFilter->getInputNBcolumns(), _retinaFilter->getInputNBrows());}
/**
* retreive retina output buffer size
* retreive retina output buffer size
*/
Size Retina::outputSize(){return cv::Size(_retinaFilter->getOutputNBcolumns(), _retinaFilter->getOutputNBrows());}
void Retina::setColorSaturation(const bool saturateColors, const float colorSaturationValue)
{
_retinaFilter->setColorSaturation(saturateColors, colorSaturationValue);
_retinaFilter->setColorSaturation(saturateColors, colorSaturationValue);
}
struct Retina::RetinaParameters Retina::getParameters(){return _retinaParameters;}
@@ -121,71 +121,71 @@ void Retina::setup(std::string retinaParameterFile, const bool applyDefaultSetup
setup(fs, applyDefaultSetupOnFailure);
}catch(Exception &e)
{
std::cout<<"Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl;
if (applyDefaultSetupOnFailure)
{
std::cout<<"Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl;
if (applyDefaultSetupOnFailure)
{
std::cout<<"Retina::setup: resetting retina with default parameters"<<std::endl;
setupOPLandIPLParvoChannel();
setupIPLMagnoChannel();
}
setupOPLandIPLParvoChannel();
setupIPLMagnoChannel();
}
else
{
std::cout<<"=> keeping current parameters"<<std::endl;
std::cout<<"=> keeping current parameters"<<std::endl;
}
}
}
void Retina::setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure)
{
try
{
// read parameters file if it exists or apply default setup if asked for
if (!fs.isOpened())
{
std::cout<<"Retina::setup: provided parameters file could not be open... skeeping configuration"<<std::endl;
return;
// implicit else case : retinaParameterFile could be open (it exists at least)
}
try
{
// read parameters file if it exists or apply default setup if asked for
if (!fs.isOpened())
{
std::cout<<"Retina::setup: provided parameters file could not be open... skeeping configuration"<<std::endl;
return;
// implicit else case : retinaParameterFile could be open (it exists at least)
}
// OPL and Parvo init first... update at the same time the parameters structure and the retina core
cv::FileNode rootFn = fs.root(), currFn=rootFn["OPLandIPLparvo"];
currFn["colorMode"]>>_retinaParameters.OPLandIplParvo.colorMode;
currFn["normaliseOutput"]>>_retinaParameters.OPLandIplParvo.normaliseOutput;
currFn["photoreceptorsLocalAdaptationSensitivity"]>>_retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity;
currFn["photoreceptorsTemporalConstant"]>>_retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant;
currFn["photoreceptorsSpatialConstant"]>>_retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant;
currFn["horizontalCellsGain"]>>_retinaParameters.OPLandIplParvo.horizontalCellsGain;
currFn["hcellsTemporalConstant"]>>_retinaParameters.OPLandIplParvo.hcellsTemporalConstant;
currFn["hcellsSpatialConstant"]>>_retinaParameters.OPLandIplParvo.hcellsSpatialConstant;
currFn["ganglionCellsSensitivity"]>>_retinaParameters.OPLandIplParvo.ganglionCellsSensitivity;
setupOPLandIPLParvoChannel(_retinaParameters.OPLandIplParvo.colorMode, _retinaParameters.OPLandIplParvo.normaliseOutput, _retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity, _retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant, _retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant, _retinaParameters.OPLandIplParvo.horizontalCellsGain, _retinaParameters.OPLandIplParvo.hcellsTemporalConstant, _retinaParameters.OPLandIplParvo.hcellsSpatialConstant, _retinaParameters.OPLandIplParvo.ganglionCellsSensitivity);
cv::FileNode rootFn = fs.root(), currFn=rootFn["OPLandIPLparvo"];
currFn["colorMode"]>>_retinaParameters.OPLandIplParvo.colorMode;
currFn["normaliseOutput"]>>_retinaParameters.OPLandIplParvo.normaliseOutput;
currFn["photoreceptorsLocalAdaptationSensitivity"]>>_retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity;
currFn["photoreceptorsTemporalConstant"]>>_retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant;
currFn["photoreceptorsSpatialConstant"]>>_retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant;
currFn["horizontalCellsGain"]>>_retinaParameters.OPLandIplParvo.horizontalCellsGain;
currFn["hcellsTemporalConstant"]>>_retinaParameters.OPLandIplParvo.hcellsTemporalConstant;
currFn["hcellsSpatialConstant"]>>_retinaParameters.OPLandIplParvo.hcellsSpatialConstant;
currFn["ganglionCellsSensitivity"]>>_retinaParameters.OPLandIplParvo.ganglionCellsSensitivity;
setupOPLandIPLParvoChannel(_retinaParameters.OPLandIplParvo.colorMode, _retinaParameters.OPLandIplParvo.normaliseOutput, _retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity, _retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant, _retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant, _retinaParameters.OPLandIplParvo.horizontalCellsGain, _retinaParameters.OPLandIplParvo.hcellsTemporalConstant, _retinaParameters.OPLandIplParvo.hcellsSpatialConstant, _retinaParameters.OPLandIplParvo.ganglionCellsSensitivity);
// init retina IPL magno setup... update at the same time the parameters structure and the retina core
currFn=rootFn["IPLmagno"];
currFn["normaliseOutput"]>>_retinaParameters.IplMagno.normaliseOutput;
currFn["parasolCells_beta"]>>_retinaParameters.IplMagno.parasolCells_beta;
currFn["parasolCells_tau"]>>_retinaParameters.IplMagno.parasolCells_tau;
currFn["parasolCells_k"]>>_retinaParameters.IplMagno.parasolCells_k;
currFn["amacrinCellsTemporalCutFrequency"]>>_retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency;
currFn["V0CompressionParameter"]>>_retinaParameters.IplMagno.V0CompressionParameter;
currFn["localAdaptintegration_tau"]>>_retinaParameters.IplMagno.localAdaptintegration_tau;
currFn["localAdaptintegration_k"]>>_retinaParameters.IplMagno.localAdaptintegration_k;
// init retina IPL magno setup... update at the same time the parameters structure and the retina core
currFn=rootFn["IPLmagno"];
currFn["normaliseOutput"]>>_retinaParameters.IplMagno.normaliseOutput;
currFn["parasolCells_beta"]>>_retinaParameters.IplMagno.parasolCells_beta;
currFn["parasolCells_tau"]>>_retinaParameters.IplMagno.parasolCells_tau;
currFn["parasolCells_k"]>>_retinaParameters.IplMagno.parasolCells_k;
currFn["amacrinCellsTemporalCutFrequency"]>>_retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency;
currFn["V0CompressionParameter"]>>_retinaParameters.IplMagno.V0CompressionParameter;
currFn["localAdaptintegration_tau"]>>_retinaParameters.IplMagno.localAdaptintegration_tau;
currFn["localAdaptintegration_k"]>>_retinaParameters.IplMagno.localAdaptintegration_k;
setupIPLMagnoChannel(_retinaParameters.IplMagno.normaliseOutput, _retinaParameters.IplMagno.parasolCells_beta, _retinaParameters.IplMagno.parasolCells_tau, _retinaParameters.IplMagno.parasolCells_k, _retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency,_retinaParameters.IplMagno.V0CompressionParameter, _retinaParameters.IplMagno.localAdaptintegration_tau, _retinaParameters.IplMagno.localAdaptintegration_k);
setupIPLMagnoChannel(_retinaParameters.IplMagno.normaliseOutput, _retinaParameters.IplMagno.parasolCells_beta, _retinaParameters.IplMagno.parasolCells_tau, _retinaParameters.IplMagno.parasolCells_k, _retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency,_retinaParameters.IplMagno.V0CompressionParameter, _retinaParameters.IplMagno.localAdaptintegration_tau, _retinaParameters.IplMagno.localAdaptintegration_k);
}catch(Exception &e)
{
std::cout<<"Retina::setup: resetting retina with default parameters"<<std::endl;
if (applyDefaultSetupOnFailure)
{
setupOPLandIPLParvoChannel();
setupIPLMagnoChannel();
}
std::cout<<"Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl;
std::cout<<"=> keeping current parameters"<<std::endl;
}
}catch(Exception &e)
{
std::cout<<"Retina::setup: resetting retina with default parameters"<<std::endl;
if (applyDefaultSetupOnFailure)
{
setupOPLandIPLParvoChannel();
setupIPLMagnoChannel();
}
std::cout<<"Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl;
std::cout<<"=> keeping current parameters"<<std::endl;
}
// report current configuration
std::cout<<printSetup()<<std::endl;
// report current configuration
std::cout<<printSetup()<<std::endl;
}
void Retina::setup(cv::Retina::RetinaParameters newConfiguration)
@@ -201,35 +201,35 @@ void Retina::setup(cv::Retina::RetinaParameters newConfiguration)
const std::string Retina::printSetup()
{
std::stringstream outmessage;
std::stringstream outmessage;
// displaying OPL and IPL parvo setup
outmessage<<"Current Retina instance setup :"
<<"\nOPLandIPLparvo"<<"{"
<< "\n==> colorMode : " << _retinaParameters.OPLandIplParvo.colorMode
<< "\n==> normalizeParvoOutput :" << _retinaParameters.OPLandIplParvo.normaliseOutput
<< "\n==> photoreceptorsLocalAdaptationSensitivity : " << _retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity
<< "\n==> photoreceptorsTemporalConstant : " << _retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant
<< "\n==> photoreceptorsSpatialConstant : " << _retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant
<< "\n==> horizontalCellsGain : " << _retinaParameters.OPLandIplParvo.horizontalCellsGain
<< "\n==> hcellsTemporalConstant : " << _retinaParameters.OPLandIplParvo.hcellsTemporalConstant
<< "\n==> hcellsSpatialConstant : " << _retinaParameters.OPLandIplParvo.hcellsSpatialConstant
<< "\n==> parvoGanglionCellsSensitivity : " << _retinaParameters.OPLandIplParvo.ganglionCellsSensitivity
<<"}\n";
// displaying OPL and IPL parvo setup
outmessage<<"Current Retina instance setup :"
<<"\nOPLandIPLparvo"<<"{"
<< "\n==> colorMode : " << _retinaParameters.OPLandIplParvo.colorMode
<< "\n==> normalizeParvoOutput :" << _retinaParameters.OPLandIplParvo.normaliseOutput
<< "\n==> photoreceptorsLocalAdaptationSensitivity : " << _retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity
<< "\n==> photoreceptorsTemporalConstant : " << _retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant
<< "\n==> photoreceptorsSpatialConstant : " << _retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant
<< "\n==> horizontalCellsGain : " << _retinaParameters.OPLandIplParvo.horizontalCellsGain
<< "\n==> hcellsTemporalConstant : " << _retinaParameters.OPLandIplParvo.hcellsTemporalConstant
<< "\n==> hcellsSpatialConstant : " << _retinaParameters.OPLandIplParvo.hcellsSpatialConstant
<< "\n==> parvoGanglionCellsSensitivity : " << _retinaParameters.OPLandIplParvo.ganglionCellsSensitivity
<<"}\n";
// displaying IPL magno setup
outmessage<<"Current Retina instance setup :"
<<"\nIPLmagno"<<"{"
<< "\n==> normaliseOutput : " << _retinaParameters.IplMagno.normaliseOutput
<< "\n==> parasolCells_beta : " << _retinaParameters.IplMagno.parasolCells_beta
<< "\n==> parasolCells_tau : " << _retinaParameters.IplMagno.parasolCells_tau
<< "\n==> parasolCells_k : " << _retinaParameters.IplMagno.parasolCells_k
<< "\n==> amacrinCellsTemporalCutFrequency : " << _retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency
<< "\n==> V0CompressionParameter : " << _retinaParameters.IplMagno.V0CompressionParameter
<< "\n==> localAdaptintegration_tau : " << _retinaParameters.IplMagno.localAdaptintegration_tau
<< "\n==> localAdaptintegration_k : " << _retinaParameters.IplMagno.localAdaptintegration_k
<<"}";
return outmessage.str();
// displaying IPL magno setup
outmessage<<"Current Retina instance setup :"
<<"\nIPLmagno"<<"{"
<< "\n==> normaliseOutput : " << _retinaParameters.IplMagno.normaliseOutput
<< "\n==> parasolCells_beta : " << _retinaParameters.IplMagno.parasolCells_beta
<< "\n==> parasolCells_tau : " << _retinaParameters.IplMagno.parasolCells_tau
<< "\n==> parasolCells_k : " << _retinaParameters.IplMagno.parasolCells_k
<< "\n==> amacrinCellsTemporalCutFrequency : " << _retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency
<< "\n==> V0CompressionParameter : " << _retinaParameters.IplMagno.V0CompressionParameter
<< "\n==> localAdaptintegration_tau : " << _retinaParameters.IplMagno.localAdaptintegration_tau
<< "\n==> localAdaptintegration_k : " << _retinaParameters.IplMagno.localAdaptintegration_k
<<"}";
return outmessage.str();
}
void Retina::write( std::string fs ) const
@@ -240,98 +240,98 @@ void Retina::write( std::string fs ) const
void Retina::write( FileStorage& fs ) const
{
if (!fs.isOpened())
return; // basic error case
fs<<"OPLandIPLparvo"<<"{";
fs << "colorMode" << _retinaParameters.OPLandIplParvo.colorMode;
fs << "normaliseOutput" << _retinaParameters.OPLandIplParvo.normaliseOutput;
fs << "photoreceptorsLocalAdaptationSensitivity" << _retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity;
fs << "photoreceptorsTemporalConstant" << _retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant;
fs << "photoreceptorsSpatialConstant" << _retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant;
fs << "horizontalCellsGain" << _retinaParameters.OPLandIplParvo.horizontalCellsGain;
fs << "hcellsTemporalConstant" << _retinaParameters.OPLandIplParvo.hcellsTemporalConstant;
fs << "hcellsSpatialConstant" << _retinaParameters.OPLandIplParvo.hcellsSpatialConstant;
fs << "ganglionCellsSensitivity" << _retinaParameters.OPLandIplParvo.ganglionCellsSensitivity;
fs << "}";
fs<<"IPLmagno"<<"{";
fs << "normaliseOutput" << _retinaParameters.IplMagno.normaliseOutput;
fs << "parasolCells_beta" << _retinaParameters.IplMagno.parasolCells_beta;
fs << "parasolCells_tau" << _retinaParameters.IplMagno.parasolCells_tau;
fs << "parasolCells_k" << _retinaParameters.IplMagno.parasolCells_k;
fs << "amacrinCellsTemporalCutFrequency" << _retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency;
fs << "V0CompressionParameter" << _retinaParameters.IplMagno.V0CompressionParameter;
fs << "localAdaptintegration_tau" << _retinaParameters.IplMagno.localAdaptintegration_tau;
fs << "localAdaptintegration_k" << _retinaParameters.IplMagno.localAdaptintegration_k;
fs<<"}";
if (!fs.isOpened())
return; // basic error case
fs<<"OPLandIPLparvo"<<"{";
fs << "colorMode" << _retinaParameters.OPLandIplParvo.colorMode;
fs << "normaliseOutput" << _retinaParameters.OPLandIplParvo.normaliseOutput;
fs << "photoreceptorsLocalAdaptationSensitivity" << _retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity;
fs << "photoreceptorsTemporalConstant" << _retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant;
fs << "photoreceptorsSpatialConstant" << _retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant;
fs << "horizontalCellsGain" << _retinaParameters.OPLandIplParvo.horizontalCellsGain;
fs << "hcellsTemporalConstant" << _retinaParameters.OPLandIplParvo.hcellsTemporalConstant;
fs << "hcellsSpatialConstant" << _retinaParameters.OPLandIplParvo.hcellsSpatialConstant;
fs << "ganglionCellsSensitivity" << _retinaParameters.OPLandIplParvo.ganglionCellsSensitivity;
fs << "}";
fs<<"IPLmagno"<<"{";
fs << "normaliseOutput" << _retinaParameters.IplMagno.normaliseOutput;
fs << "parasolCells_beta" << _retinaParameters.IplMagno.parasolCells_beta;
fs << "parasolCells_tau" << _retinaParameters.IplMagno.parasolCells_tau;
fs << "parasolCells_k" << _retinaParameters.IplMagno.parasolCells_k;
fs << "amacrinCellsTemporalCutFrequency" << _retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency;
fs << "V0CompressionParameter" << _retinaParameters.IplMagno.V0CompressionParameter;
fs << "localAdaptintegration_tau" << _retinaParameters.IplMagno.localAdaptintegration_tau;
fs << "localAdaptintegration_k" << _retinaParameters.IplMagno.localAdaptintegration_k;
fs<<"}";
}
void Retina::setupOPLandIPLParvoChannel(const bool colorMode, const bool normaliseOutput, const float photoreceptorsLocalAdaptationSensitivity, const float photoreceptorsTemporalConstant, const float photoreceptorsSpatialConstant, const float horizontalCellsGain, const float HcellsTemporalConstant, const float HcellsSpatialConstant, const float ganglionCellsSensitivity)
{
// retina core parameters setup
_retinaFilter->setColorMode(colorMode);
_retinaFilter->setPhotoreceptorsLocalAdaptationSensitivity(photoreceptorsLocalAdaptationSensitivity);
_retinaFilter->setOPLandParvoParameters(0, photoreceptorsTemporalConstant, photoreceptorsSpatialConstant, horizontalCellsGain, HcellsTemporalConstant, HcellsSpatialConstant, ganglionCellsSensitivity);
_retinaFilter->setParvoGanglionCellsLocalAdaptationSensitivity(ganglionCellsSensitivity);
_retinaFilter->activateNormalizeParvoOutput_0_maxOutputValue(normaliseOutput);
// retina core parameters setup
_retinaFilter->setColorMode(colorMode);
_retinaFilter->setPhotoreceptorsLocalAdaptationSensitivity(photoreceptorsLocalAdaptationSensitivity);
_retinaFilter->setOPLandParvoParameters(0, photoreceptorsTemporalConstant, photoreceptorsSpatialConstant, horizontalCellsGain, HcellsTemporalConstant, HcellsSpatialConstant, ganglionCellsSensitivity);
_retinaFilter->setParvoGanglionCellsLocalAdaptationSensitivity(ganglionCellsSensitivity);
_retinaFilter->activateNormalizeParvoOutput_0_maxOutputValue(normaliseOutput);
// update parameters struture
_retinaParameters.OPLandIplParvo.colorMode = colorMode;
_retinaParameters.OPLandIplParvo.normaliseOutput = normaliseOutput;
_retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity = photoreceptorsLocalAdaptationSensitivity;
_retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant = photoreceptorsTemporalConstant;
_retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant = photoreceptorsSpatialConstant;
_retinaParameters.OPLandIplParvo.horizontalCellsGain = horizontalCellsGain;
_retinaParameters.OPLandIplParvo.hcellsTemporalConstant = HcellsTemporalConstant;
_retinaParameters.OPLandIplParvo.hcellsSpatialConstant = HcellsSpatialConstant;
_retinaParameters.OPLandIplParvo.ganglionCellsSensitivity = ganglionCellsSensitivity;
_retinaParameters.OPLandIplParvo.colorMode = colorMode;
_retinaParameters.OPLandIplParvo.normaliseOutput = normaliseOutput;
_retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity = photoreceptorsLocalAdaptationSensitivity;
_retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant = photoreceptorsTemporalConstant;
_retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant = photoreceptorsSpatialConstant;
_retinaParameters.OPLandIplParvo.horizontalCellsGain = horizontalCellsGain;
_retinaParameters.OPLandIplParvo.hcellsTemporalConstant = HcellsTemporalConstant;
_retinaParameters.OPLandIplParvo.hcellsSpatialConstant = HcellsSpatialConstant;
_retinaParameters.OPLandIplParvo.ganglionCellsSensitivity = ganglionCellsSensitivity;
}
void Retina::setupIPLMagnoChannel(const bool normaliseOutput, const float parasolCells_beta, const float parasolCells_tau, const float parasolCells_k, const float amacrinCellsTemporalCutFrequency, const float V0CompressionParameter, const float localAdaptintegration_tau, const float localAdaptintegration_k)
{
_retinaFilter->setMagnoCoefficientsTable(parasolCells_beta, parasolCells_tau, parasolCells_k, amacrinCellsTemporalCutFrequency, V0CompressionParameter, localAdaptintegration_tau, localAdaptintegration_k);
_retinaFilter->activateNormalizeMagnoOutput_0_maxOutputValue(normaliseOutput);
_retinaFilter->setMagnoCoefficientsTable(parasolCells_beta, parasolCells_tau, parasolCells_k, amacrinCellsTemporalCutFrequency, V0CompressionParameter, localAdaptintegration_tau, localAdaptintegration_k);
_retinaFilter->activateNormalizeMagnoOutput_0_maxOutputValue(normaliseOutput);
// update parameters struture
_retinaParameters.IplMagno.normaliseOutput = normaliseOutput;
_retinaParameters.IplMagno.parasolCells_beta = parasolCells_beta;
_retinaParameters.IplMagno.parasolCells_tau = parasolCells_tau;
_retinaParameters.IplMagno.parasolCells_k = parasolCells_k;
_retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency = amacrinCellsTemporalCutFrequency;
_retinaParameters.IplMagno.V0CompressionParameter = V0CompressionParameter;
_retinaParameters.IplMagno.localAdaptintegration_tau = localAdaptintegration_tau;
_retinaParameters.IplMagno.localAdaptintegration_k = localAdaptintegration_k;
_retinaParameters.IplMagno.normaliseOutput = normaliseOutput;
_retinaParameters.IplMagno.parasolCells_beta = parasolCells_beta;
_retinaParameters.IplMagno.parasolCells_tau = parasolCells_tau;
_retinaParameters.IplMagno.parasolCells_k = parasolCells_k;
_retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency = amacrinCellsTemporalCutFrequency;
_retinaParameters.IplMagno.V0CompressionParameter = V0CompressionParameter;
_retinaParameters.IplMagno.localAdaptintegration_tau = localAdaptintegration_tau;
_retinaParameters.IplMagno.localAdaptintegration_k = localAdaptintegration_k;
}
void Retina::run(const cv::Mat &inputMatToConvert)
{
// first convert input image to the compatible format : std::valarray<float>
const bool colorMode = _convertCvMat2ValarrayBuffer(inputMatToConvert, _inputBuffer);
// process the retina
if (!_retinaFilter->runFilter(_inputBuffer, colorMode, false, _retinaParameters.OPLandIplParvo.colorMode && colorMode, false))
throw cv::Exception(-1, "Retina cannot be applied, wrong input buffer size", "Retina::run", "Retina.h", 0);
// first convert input image to the compatible format : std::valarray<float>
const bool colorMode = _convertCvMat2ValarrayBuffer(inputMatToConvert, _inputBuffer);
// process the retina
if (!_retinaFilter->runFilter(_inputBuffer, colorMode, false, _retinaParameters.OPLandIplParvo.colorMode && colorMode, false))
throw cv::Exception(-1, "Retina cannot be applied, wrong input buffer size", "Retina::run", "Retina.h", 0);
}
void Retina::getParvo(cv::Mat &retinaOutput_parvo)
{
if (_retinaFilter->getColorMode())
{
// reallocate output buffer (if necessary)
_convertValarrayBuffer2cvMat(_retinaFilter->getColorOutput(), _retinaFilter->getOutputNBrows(), _retinaFilter->getOutputNBcolumns(), true, retinaOutput_parvo);
}else
{
// reallocate output buffer (if necessary)
_convertValarrayBuffer2cvMat(_retinaFilter->getContours(), _retinaFilter->getOutputNBrows(), _retinaFilter->getOutputNBcolumns(), false, retinaOutput_parvo);
}
//retinaOutput_parvo/=255.0;
if (_retinaFilter->getColorMode())
{
// reallocate output buffer (if necessary)
_convertValarrayBuffer2cvMat(_retinaFilter->getColorOutput(), _retinaFilter->getOutputNBrows(), _retinaFilter->getOutputNBcolumns(), true, retinaOutput_parvo);
}else
{
// reallocate output buffer (if necessary)
_convertValarrayBuffer2cvMat(_retinaFilter->getContours(), _retinaFilter->getOutputNBrows(), _retinaFilter->getOutputNBcolumns(), false, retinaOutput_parvo);
}
//retinaOutput_parvo/=255.0;
}
void Retina::getMagno(cv::Mat &retinaOutput_magno)
{
// reallocate output buffer (if necessary)
_convertValarrayBuffer2cvMat(_retinaFilter->getMovingContours(), _retinaFilter->getOutputNBrows(), _retinaFilter->getOutputNBcolumns(), false, retinaOutput_magno);
//retinaOutput_magno/=255.0;
// reallocate output buffer (if necessary)
_convertValarrayBuffer2cvMat(_retinaFilter->getMovingContours(), _retinaFilter->getOutputNBrows(), _retinaFilter->getOutputNBcolumns(), false, retinaOutput_magno);
//retinaOutput_magno/=255.0;
}
// original API level data accessors : copy buffers if size matches
@@ -344,110 +344,112 @@ const std::valarray<float> & Retina::getParvo() const {if (_retinaFilter->getCol
// private method called by constructirs
void Retina::_init(const cv::Size inputSize, const bool colorMode, RETINA_COLORSAMPLINGMETHOD colorSamplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght)
{
// basic error check
if (inputSize.height*inputSize.width <= 0)
throw cv::Exception(-1, "Bad retina size setup : size height and with must be superior to zero", "Retina::setup", "Retina.h", 0);
// basic error check
if (inputSize.height*inputSize.width <= 0)
throw cv::Exception(-1, "Bad retina size setup : size height and with must be superior to zero", "Retina::setup", "Retina.h", 0);
unsigned int nbPixels=inputSize.height*inputSize.width;
// resize buffers if size does not match
_inputBuffer.resize(nbPixels*3); // buffer supports gray images but also 3 channels color buffers... (larger is better...)
unsigned int nbPixels=inputSize.height*inputSize.width;
// resize buffers if size does not match
_inputBuffer.resize(nbPixels*3); // buffer supports gray images but also 3 channels color buffers... (larger is better...)
// allocate the retina model
// allocate the retina model
if (_retinaFilter)
delete _retinaFilter;
_retinaFilter = new RetinaFilter(inputSize.height, inputSize.width, colorMode, colorSamplingMethod, useRetinaLogSampling, reductionFactor, samplingStrenght);
_retinaFilter = new RetinaFilter(inputSize.height, inputSize.width, colorMode, colorSamplingMethod, useRetinaLogSampling, reductionFactor, samplingStrenght);
// prepare the default parameter XML file with default setup
// prepare the default parameter XML file with default setup
setup(_retinaParameters);
// init retina
_retinaFilter->clearAllBuffers();
// init retina
_retinaFilter->clearAllBuffers();
// report current configuration
std::cout<<printSetup()<<std::endl;
// report current configuration
std::cout<<printSetup()<<std::endl;
}
void Retina::_convertValarrayBuffer2cvMat(const std::valarray<float> &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, cv::Mat &outBuffer)
{
// fill output buffer with the valarray buffer
const float *valarrayPTR=get_data(grayMatrixToConvert);
if (!colorMode)
{
outBuffer.create(cv::Size(nbColumns, nbRows), CV_8U);
for (unsigned int i=0;i<nbRows;++i)
{
for (unsigned int j=0;j<nbColumns;++j)
{
cv::Point2d pixel(j,i);
outBuffer.at<unsigned char>(pixel)=(unsigned char)*(valarrayPTR++);
}
}
}else
{
const unsigned int doubleNBpixels=_retinaFilter->getOutputNBpixels()*2;
outBuffer.create(cv::Size(nbColumns, nbRows), CV_8UC3);
for (unsigned int i=0;i<nbRows;++i)
{
for (unsigned int j=0;j<nbColumns;++j,++valarrayPTR)
{
cv::Point2d pixel(j,i);
cv::Vec3b pixelValues;
pixelValues[2]=(unsigned char)*(valarrayPTR);
pixelValues[1]=(unsigned char)*(valarrayPTR+_retinaFilter->getOutputNBpixels());
pixelValues[0]=(unsigned char)*(valarrayPTR+doubleNBpixels);
// fill output buffer with the valarray buffer
const float *valarrayPTR=get_data(grayMatrixToConvert);
if (!colorMode)
{
outBuffer.create(cv::Size(nbColumns, nbRows), CV_8U);
for (unsigned int i=0;i<nbRows;++i)
{
for (unsigned int j=0;j<nbColumns;++j)
{
cv::Point2d pixel(j,i);
outBuffer.at<unsigned char>(pixel)=(unsigned char)*(valarrayPTR++);
}
}
}else
{
const unsigned int doubleNBpixels=_retinaFilter->getOutputNBpixels()*2;
outBuffer.create(cv::Size(nbColumns, nbRows), CV_8UC3);
for (unsigned int i=0;i<nbRows;++i)
{
for (unsigned int j=0;j<nbColumns;++j,++valarrayPTR)
{
cv::Point2d pixel(j,i);
cv::Vec3b pixelValues;
pixelValues[2]=(unsigned char)*(valarrayPTR);
pixelValues[1]=(unsigned char)*(valarrayPTR+_retinaFilter->getOutputNBpixels());
pixelValues[0]=(unsigned char)*(valarrayPTR+doubleNBpixels);
outBuffer.at<cv::Vec3b>(pixel)=pixelValues;
}
}
}
outBuffer.at<cv::Vec3b>(pixel)=pixelValues;
}
}
}
}
bool Retina::_convertCvMat2ValarrayBuffer(const cv::Mat inputMatToConvert, std::valarray<float> &outputValarrayMatrix)
{
// first check input consistency
if (inputMatToConvert.empty())
throw cv::Exception(-1, "Retina cannot be applied, input buffer is empty", "Retina::run", "Retina.h", 0);
// first check input consistency
if (inputMatToConvert.empty())
throw cv::Exception(-1, "Retina cannot be applied, input buffer is empty", "Retina::run", "Retina.h", 0);
// retreive color mode from image input
int imageNumberOfChannels = inputMatToConvert.channels();
// retreive color mode from image input
int imageNumberOfChannels = inputMatToConvert.channels();
// convert to float AND fill the valarray buffer
typedef float T; // define here the target pixel format, here, float
typedef float T; // define here the target pixel format, here, float
const int dsttype = DataType<T>::depth; // output buffer is float format
if(imageNumberOfChannels==4)
if(imageNumberOfChannels==4)
{
// create a cv::Mat table (for RGBA planes)
cv::Mat planes[4] =
{
// create a cv::Mat table (for RGBA planes)
cv::Mat planes[] =
{
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()*2]),
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()]),
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[0]),
cv::Mat(inputMatToConvert.size(), dsttype) // last channel (alpha) does not point on the valarray (not usefull in our case)
};
// split color cv::Mat in 4 planes... it fills valarray directely
cv::split(cv::Mat_<Vec<T, 4> >(inputMatToConvert), planes);
}else if (imageNumberOfChannels==3)
{
// create a cv::Mat table (for RGB planes)
cv::Mat planes[] =
{
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()*2]),
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()]),
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[0])
};
// split color cv::Mat in 3 planes... it fills valarray directely
cv::split(cv::Mat_<Vec<T, 3> >(inputMatToConvert), planes);
}else if(imageNumberOfChannels==1)
{
// create a cv::Mat header for the valarray
cv::Mat dst(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[0]);
inputMatToConvert.convertTo(dst, dsttype);
}
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()*2]),
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()]),
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[0])
};
planes[3] = cv::Mat(inputMatToConvert.size(), dsttype); // last channel (alpha) does not point on the valarray (not usefull in our case)
// split color cv::Mat in 4 planes... it fills valarray directely
cv::split(cv::Mat_<Vec<T, 4> >(inputMatToConvert), planes);
}
else if (imageNumberOfChannels==3)
{
// create a cv::Mat table (for RGB planes)
cv::Mat planes[] =
{
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()*2]),
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()]),
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[0])
};
// split color cv::Mat in 3 planes... it fills valarray directely
cv::split(cv::Mat_<Vec<T, 3> >(inputMatToConvert), planes);
}
else if(imageNumberOfChannels==1)
{
// create a cv::Mat header for the valarray
cv::Mat dst(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[0]);
inputMatToConvert.convertTo(dst, dsttype);
}
else
CV_Error(CV_StsUnsupportedFormat, "input image must be single channel (gray levels), bgr format (color) or bgra (color with transparency which won't be considered");
return imageNumberOfChannels>1; // return bool : false for gray level image processing, true for color mode
}

View File

@@ -869,6 +869,8 @@ cvGetModuleInfo( const char* name, const char **version, const char **plugin_lis
}
#if defined BUILD_SHARED_LIBS && defined CVAPI_EXPORTS && defined WIN32 && !defined WINCE
BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID );
BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID )
{
if( fdwReason == DLL_THREAD_DETACH || fdwReason == DLL_PROCESS_DETACH )

View File

@@ -133,7 +133,7 @@ CV_INIT_ALGORITHM(DenseFeatureDetector, "Feature2D.Dense",
obj.info()->addParam(obj, "varyImgBoundWithScale", obj.varyImgBoundWithScale));
CV_INIT_ALGORITHM(GridAdaptedFeatureDetector, "Feature2D.Grid",
//obj.info()->addParam(obj, "detector", (Ptr<Algorithm>&)obj.detector);
obj.info()->addParam(obj, "detector", (Ptr<Algorithm>&)obj.detector);
obj.info()->addParam(obj, "maxTotalKeypoints", obj.maxTotalKeypoints);
obj.info()->addParam(obj, "gridRows", obj.gridRows);
obj.info()->addParam(obj, "gridCols", obj.gridCols));

View File

@@ -911,7 +911,7 @@ void CV_DescriptorMatcherTest::radiusMatchTest( const Mat& query, const Mat& tra
dmatcher->radiusMatch( query, matches, radius, masks );
int curRes = cvtest::TS::OK;
//int curRes = cvtest::TS::OK;
if( (int)matches.size() != queryDescCount )
{
ts->printf(cvtest::TS::LOG, "Incorrect matches count while test radiusMatch() function (1).\n");
@@ -951,7 +951,7 @@ void CV_DescriptorMatcherTest::radiusMatchTest( const Mat& query, const Mat& tra
}
if( (float)badCount > (float)queryDescCount*badPart )
{
curRes = cvtest::TS::FAIL_INVALID_OUTPUT;
//curRes = cvtest::TS::FAIL_INVALID_OUTPUT;
ts->printf( cvtest::TS::LOG, "%f - too large bad matches part while test radiusMatch() function (2).\n",
(float)badCount/(float)queryDescCount );
ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );

View File

@@ -65,7 +65,7 @@
#undef FLANN_PLATFORM_32_BIT
#undef FLANN_PLATFORM_64_BIT
#if __amd64__ || __x86_64__ || _WIN64 || _M_X64
#if defined __amd64__ || defined __x86_64__ || defined _WIN64 || defined _M_X64
#define FLANN_PLATFORM_64_BIT
#else
#define FLANN_PLATFORM_32_BIT

View File

@@ -164,7 +164,7 @@ float test_index_precision(NNIndex<Distance>& index, const Matrix<typename Dista
int c2 = 1;
float p2;
int c1 = 1;
float p1;
//float p1;
float time;
DistanceType dist;
@@ -178,7 +178,7 @@ float test_index_precision(NNIndex<Distance>& index, const Matrix<typename Dista
while (p2<precision) {
c1 = c2;
p1 = p2;
//p1 = p2;
c2 *=2;
p2 = search_with_ground_truth(index, inputData, testData, matches, nn, c2, time, dist, distance, skipMatches);
}

View File

@@ -133,12 +133,8 @@ endif()
if(HAVE_OPENNI)
list(APPEND highgui_srcs src/cap_openni.cpp)
ocv_include_directories(${OPENNI_INCLUDE_DIR})
include_directories(AFTER SYSTEM ${OPENNI_INCLUDE_DIR})
list(APPEND HIGHGUI_LIBRARIES ${OPENNI_LIBRARY})
if(CMAKE_COMPILER_IS_GNUCXX)
set_source_files_properties(src/cap_openni.cpp PROPERTIES COMPILE_FLAGS "-Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder -Wno-strict-aliasing")
endif()
endif(HAVE_OPENNI)
if(HAVE_opencv_androidcamera)
@@ -194,7 +190,7 @@ endif()
if(WIN32)
link_directories("${OpenCV_SOURCE_DIR}/3rdparty/lib") # for ffmpeg wrapper only
include_directories(AFTER "${OpenCV_SOURCE_DIR}/3rdparty/include") # for directshow in VS2005 and multi-monitor support on MinGW
include_directories(AFTER SYSTEM "${OpenCV_SOURCE_DIR}/3rdparty/include") # for directshow in VS2005 and multi-monitor support on MinGW
endif()
if(UNIX)
@@ -228,10 +224,7 @@ endif()
set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "")
ocv_add_precompiled_headers(${the_module})
if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
endif()
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-deprecated-declarations)
if(WIN32 AND WITH_FFMPEG)
#copy ffmpeg dll to the output folder

View File

@@ -45,7 +45,7 @@
/****************** Capturing video from camera via CMU lib *******************/
#if HAVE_CMU1394
#ifdef HAVE_CMU1394
// This firewire capability added by Philip Gruebele (pgruebele@cox.net).
// For this to work you need to install the CMU firewire DCAM drivers,

View File

@@ -89,7 +89,7 @@ Thanks to:
#include "precomp.hpp"
#if _MSC_VER >= 100
#if defined _MSC_VER && _MSC_VER >= 100
#pragma warning(disable: 4995)
#endif
@@ -103,17 +103,18 @@ Thanks to:
#include <vector>
//Include Directshow stuff here so we don't worry about needing all the h files.
#if _MSC_VER >= 1500
#include "DShow.h"
#include "strmif.h"
#include "Aviriff.h"
#include "dvdmedia.h"
#include "bdaiface.h"
#if defined _MSC_VER && _MSC_VER >= 1500
# include "DShow.h"
# include "strmif.h"
# include "Aviriff.h"
# include "dvdmedia.h"
# include "bdaiface.h"
#else
#ifdef _MSC_VER
#define __extension__
typedef BOOL WINBOOL;
# ifdef _MSC_VER
# define __extension__
typedef BOOL WINBOOL;
#endif
#include "dshow/dshow.h"
#include "dshow/dvdmedia.h"
#include "dshow/bdatypes.h"
@@ -133,6 +134,8 @@ public:
virtual HRESULT STDMETHODCALLTYPE Clone(
/* [out] */ IEnumPIDMap **ppIEnumPIDMap) = 0;
virtual ~IEnumPIDMap() {}
};
interface IMPEG2PIDMap : public IUnknown
@@ -148,6 +151,8 @@ interface IMPEG2PIDMap : public IUnknown
virtual HRESULT STDMETHODCALLTYPE EnumPIDMap(
/* [out] */ IEnumPIDMap **pIEnumPIDMap) = 0;
virtual ~IMPEG2PIDMap() {}
};
#endif
@@ -234,6 +239,7 @@ interface ISampleGrabberCB : public IUnknown
BYTE *pBuffer,
LONG BufferLen) = 0;
virtual ~ISampleGrabberCB() {}
};
interface ISampleGrabber : public IUnknown
@@ -261,6 +267,7 @@ interface ISampleGrabber : public IUnknown
ISampleGrabberCB *pCallback,
LONG WhichMethodToCallback) = 0;
virtual ~ISampleGrabber() {}
};
#ifndef HEADER
@@ -519,12 +526,12 @@ class videoInput{
//Manual control over settings thanks.....
//These are experimental for now.
bool setVideoSettingFilter(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
bool setVideoSettingFilterPct(int deviceID, long Property, float pctValue, long Flags = NULL);
bool setVideoSettingFilter(int deviceID, long Property, long lValue, long Flags = 0, bool useDefaultValue = false);
bool setVideoSettingFilterPct(int deviceID, long Property, float pctValue, long Flags = 0);
bool getVideoSettingFilter(int deviceID, long Property, long &min, long &max, long &SteppingDelta, long &currentValue, long &flags, long &defaultValue);
bool setVideoSettingCamera(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
bool setVideoSettingCameraPct(int deviceID, long Property, float pctValue, long Flags = NULL);
bool setVideoSettingCamera(int deviceID, long Property, long lValue, long Flags = 0, bool useDefaultValue = false);
bool setVideoSettingCameraPct(int deviceID, long Property, float pctValue, long Flags = 0);
bool getVideoSettingCamera(int deviceID, long Property, long &min, long &max, long &SteppingDelta, long &currentValue, long &flags, long &defaultValue);
//bool setVideoSettingCam(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
@@ -597,7 +604,7 @@ class videoInput{
/////////////////////////// HANDY FUNCTIONS /////////////////////////////
void MyFreeMediaType(AM_MEDIA_TYPE& mt){
static void MyFreeMediaType(AM_MEDIA_TYPE& mt){
if (mt.cbFormat != 0)
{
CoTaskMemFree((PVOID)mt.pbFormat);
@@ -612,7 +619,7 @@ void MyFreeMediaType(AM_MEDIA_TYPE& mt){
}
}
void MyDeleteMediaType(AM_MEDIA_TYPE *pmt)
static void MyDeleteMediaType(AM_MEDIA_TYPE *pmt)
{
if (pmt != NULL)
{
@@ -642,7 +649,7 @@ public:
//------------------------------------------------
~SampleGrabberCallback(){
virtual ~SampleGrabberCallback(){
ptrBuffer = NULL;
DeleteCriticalSection(&critSection);
CloseHandle(hEvent);
@@ -849,7 +856,7 @@ void videoDevice::NukeDownstream(IBaseFilter *pBF){
// ----------------------------------------------------------------------
void videoDevice::destroyGraph(){
HRESULT hr = NULL;
HRESULT hr = 0;
//int FuncRetval=0;
//int NumFilters=0;
@@ -867,7 +874,7 @@ void videoDevice::destroyGraph(){
IBaseFilter * pFilter = NULL;
if (pEnum->Next(1, &pFilter, &cFetched) == S_OK)
{
FILTER_INFO FilterInfo={0};
FILTER_INFO FilterInfo;
memset(&FilterInfo, 0, sizeof(FilterInfo));
hr = pFilter->QueryFilterInfo(&FilterInfo);
FilterInfo.pGraph->Release();
@@ -1620,14 +1627,15 @@ void __cdecl videoInput::basicThread(void * objPtr){
void videoInput::showSettingsWindow(int id){
if(isDeviceSetup(id)){
HANDLE myTempThread;
//HANDLE myTempThread;
//we reconnect to the device as we have freed our reference to it
//why have we freed our reference? because there seemed to be an issue
//with some mpeg devices if we didn't
HRESULT hr = getDevice(&VDList[id]->pVideoInputFilter, id, VDList[id]->wDeviceName, VDList[id]->nDeviceName);
if(hr == S_OK){
myTempThread = (HANDLE)_beginthread(basicThread, 0, (void *)&VDList[id]);
//myTempThread = (HANDLE)
_beginthread(basicThread, 0, (void *)&VDList[id]);
}
}
}
@@ -1705,7 +1713,7 @@ bool videoInput::setVideoSettingFilterPct(int deviceID, long Property, float pct
float halfStep = (float)stepAmnt * 0.5f;
if( mod < halfStep ) rasterValue -= mod;
else rasterValue += stepAmnt - mod;
printf("RASTER - pctValue is %f - value is %i - step is %i - mod is %i - rasterValue is %i\n", pctValue, value, stepAmnt, mod, rasterValue);
printf("RASTER - pctValue is %f - value is %li - step is %li - mod is %li - rasterValue is %li\n", pctValue, value, stepAmnt, mod, rasterValue);
}
return setVideoSettingFilter(deviceID, Property, rasterValue, Flags, false);
@@ -1795,7 +1803,7 @@ bool videoInput::setVideoSettingCameraPct(int deviceID, long Property, float pct
float halfStep = (float)stepAmnt * 0.5f;
if( mod < halfStep ) rasterValue -= mod;
else rasterValue += stepAmnt - mod;
printf("RASTER - pctValue is %f - value is %i - step is %i - mod is %i - rasterValue is %i\n", pctValue, value, stepAmnt, mod, rasterValue);
printf("RASTER - pctValue is %f - value is %li - step is %li - mod is %li - rasterValue is %li\n", pctValue, value, stepAmnt, mod, rasterValue);
}
return setVideoSettingCamera(deviceID, Property, rasterValue, Flags, false);
@@ -1920,7 +1928,7 @@ bool videoInput::restartDevice(int id){
stopDevice(id);
//set our fps if needed
if( avgFrameTime != -1){
if( avgFrameTime != (unsigned long)-1){
VDList[id]->requestedFrameTime = avgFrameTime;
}
@@ -2300,7 +2308,7 @@ static void findClosestSizeAndSubtype(videoDevice * VD, int widthIn, int heightI
//find perfect match or closest size
int nearW = 9999999;
int nearH = 9999999;
bool foundClosestMatch = true;
//bool foundClosestMatch = true;
int iCount = 0;
int iSize = 0;
@@ -2360,7 +2368,7 @@ static void findClosestSizeAndSubtype(videoDevice * VD, int widthIn, int heightI
//see if we have an exact match!
if(exactMatchX && exactMatchY){
foundClosestMatch = false;
//foundClosestMatch = false;
exactMatch = true;
widthOut = widthIn;

View File

@@ -43,7 +43,7 @@
#include <vfw.h>
#if _MSC_VER >= 1200
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4711 )
#endif

View File

@@ -43,7 +43,7 @@
#if defined WIN32 || defined _WIN32
#if _MSC_VER >= 1200
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4710 )
#endif
@@ -61,6 +61,10 @@
#ifndef __inout
# define __inout
#endif
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wmissing-declarations"
#endif
#include <MultiMon.h>
#include <commctrl.h>
@@ -166,7 +170,7 @@ typedef struct CvWindow
HGDIOBJ image;
int last_key;
int flags;
int status;//0 normal, 1 fullscreen (YV)
int status;//0 normal, 1 fullscreen (YV)
CvMouseCallback on_mouse;
void* on_mouse_param;
@@ -360,7 +364,7 @@ icvSaveWindowPos( const char* name, CvRect rect )
char rootKey[1024];
strcpy( szKey, icvWindowPosRootKey );
strcat( szKey, name );
if( RegOpenKeyEx( HKEY_CURRENT_USER,szKey,0,KEY_READ,&hkey) != ERROR_SUCCESS )
{
HKEY hroot;
@@ -405,7 +409,7 @@ icvSaveWindowPos( const char* name, CvRect rect )
if( RegOpenKeyEx( HKEY_CURRENT_USER,szKey,0,KEY_WRITE,&hkey) != ERROR_SUCCESS )
return;
}
RegSetValueEx(hkey, "Left", 0, REG_DWORD, (BYTE*)&rect.x, sizeof(rect.x));
RegSetValueEx(hkey, "Top", 0, REG_DWORD, (BYTE*)&rect.y, sizeof(rect.y));
RegSetValueEx(hkey, "Width", 0, REG_DWORD, (BYTE*)&rect.width, sizeof(rect.width));
@@ -415,9 +419,9 @@ icvSaveWindowPos( const char* name, CvRect rect )
double cvGetModeWindow_W32(const char* name)//YV
{
double result = -1;
CV_FUNCNAME( "cvGetModeWindow_W32" );
double result = -1;
CV_FUNCNAME( "cvGetModeWindow_W32" );
__BEGIN__;
@@ -429,75 +433,75 @@ double cvGetModeWindow_W32(const char* name)//YV
window = icvFindWindowByName( name );
if (!window)
EXIT; // keep silence here
result = window->status;
__END__;
return result;
return result;
}
void cvSetModeWindow_W32( const char* name, double prop_value)//Yannick Verdie
{
CV_FUNCNAME( "cvSetModeWindow_W32" );
CV_FUNCNAME( "cvSetModeWindow_W32" );
__BEGIN__;
__BEGIN__;
CvWindow* window;
CvWindow* window;
if(!name)
CV_ERROR( CV_StsNullPtr, "NULL name string" );
if(!name)
CV_ERROR( CV_StsNullPtr, "NULL name string" );
window = icvFindWindowByName( name );
if( !window )
CV_ERROR( CV_StsNullPtr, "NULL window" );
window = icvFindWindowByName( name );
if( !window )
CV_ERROR( CV_StsNullPtr, "NULL window" );
if(window->flags & CV_WINDOW_AUTOSIZE)//if the flag CV_WINDOW_AUTOSIZE is set
EXIT;
if(window->flags & CV_WINDOW_AUTOSIZE)//if the flag CV_WINDOW_AUTOSIZE is set
EXIT;
{
DWORD dwStyle = (DWORD)GetWindowLongPtr(window->frame, GWL_STYLE);
CvRect position;
{
DWORD dwStyle = (DWORD)GetWindowLongPtr(window->frame, GWL_STYLE);
CvRect position;
if (window->status==CV_WINDOW_FULLSCREEN && prop_value==CV_WINDOW_NORMAL)
{
icvLoadWindowPos(window->name,position );
SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle | WS_CAPTION | WS_THICKFRAME);
if (window->status==CV_WINDOW_FULLSCREEN && prop_value==CV_WINDOW_NORMAL)
{
icvLoadWindowPos(window->name,position );
SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle | WS_CAPTION | WS_THICKFRAME);
SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
window->status=CV_WINDOW_NORMAL;
SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
window->status=CV_WINDOW_NORMAL;
EXIT;
}
EXIT;
}
if (window->status==CV_WINDOW_NORMAL && prop_value==CV_WINDOW_FULLSCREEN)
{
//save dimension
RECT rect;
GetWindowRect(window->frame, &rect);
CvRect RectCV = cvRect(rect.left, rect.top,rect.right - rect.left, rect.bottom - rect.top);
icvSaveWindowPos(window->name,RectCV );
if (window->status==CV_WINDOW_NORMAL && prop_value==CV_WINDOW_FULLSCREEN)
{
//save dimension
RECT rect;
GetWindowRect(window->frame, &rect);
CvRect RectCV = cvRect(rect.left, rect.top,rect.right - rect.left, rect.bottom - rect.top);
icvSaveWindowPos(window->name,RectCV );
//Look at coordinate for fullscreen
HMONITOR hMonitor;
MONITORINFO mi;
hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
//Look at coordinate for fullscreen
HMONITOR hMonitor;
MONITORINFO mi;
hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
mi.cbSize = sizeof(mi);
GetMonitorInfo(hMonitor, &mi);
mi.cbSize = sizeof(mi);
GetMonitorInfo(hMonitor, &mi);
//fullscreen
position.x=mi.rcMonitor.left;position.y=mi.rcMonitor.top;
position.width=mi.rcMonitor.right - mi.rcMonitor.left;position.height=mi.rcMonitor.bottom - mi.rcMonitor.top;
SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle & ~WS_CAPTION & ~WS_THICKFRAME);
//fullscreen
position.x=mi.rcMonitor.left;position.y=mi.rcMonitor.top;
position.width=mi.rcMonitor.right - mi.rcMonitor.left;position.height=mi.rcMonitor.bottom - mi.rcMonitor.top;
SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle & ~WS_CAPTION & ~WS_THICKFRAME);
SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
window->status=CV_WINDOW_FULLSCREEN;
SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
window->status=CV_WINDOW_FULLSCREEN;
EXIT;
}
}
EXIT;
}
}
__END__;
__END__;
}
double cvGetPropWindowAutoSize_W32(const char* name)
@@ -526,9 +530,9 @@ double cvGetPropWindowAutoSize_W32(const char* name)
double cvGetRatioWindow_W32(const char* name)
{
double result = -1;
CV_FUNCNAME( "cvGetRatioWindow_W32" );
double result = -1;
CV_FUNCNAME( "cvGetRatioWindow_W32" );
__BEGIN__;
@@ -540,20 +544,20 @@ double cvGetRatioWindow_W32(const char* name)
window = icvFindWindowByName( name );
if (!window)
EXIT; // keep silence here
result = static_cast<double>(window->width) / window->height;
__END__;
return result;
return result;
}
double cvGetOpenGlProp_W32(const char* name)
{
double result = -1;
double result = -1;
#ifdef HAVE_OPENGL
CV_FUNCNAME( "cvGetOpenGlProp_W32" );
#ifdef HAVE_OPENGL
CV_FUNCNAME( "cvGetOpenGlProp_W32" );
__BEGIN__;
@@ -565,14 +569,14 @@ double cvGetOpenGlProp_W32(const char* name)
window = icvFindWindowByName( name );
if (!window)
EXIT; // keep silence here
result = window->useGl;
__END__;
#endif
(void)name;
(void)name;
return result;
return result;
}
@@ -626,7 +630,7 @@ namespace
void generateBitmapFont(const std::string& family, int height, int weight, bool italic, bool underline, int start, int count, int base) const;
bool isGlContextInitialized() const;
PFNGLGENBUFFERSPROC glGenBuffersExt;
PFNGLDELETEBUFFERSPROC glDeleteBuffersExt;
@@ -787,8 +791,8 @@ namespace
weight, // font weight
italic ? TRUE : FALSE, // Italic
underline ? TRUE : FALSE, // Underline
FALSE, // StrikeOut
ANSI_CHARSET, // CharSet
FALSE, // StrikeOut
ANSI_CHARSET, // CharSet
OUT_TT_PRECIS, // OutPrecision
CLIP_DEFAULT_PRECIS, // ClipPrecision
ANTIALIASED_QUALITY, // Quality
@@ -870,12 +874,12 @@ namespace
0, // Shift Bit Ignored
0, // No Accumulation Buffer
0, 0, 0, 0, // Accumulation Bits Ignored
32, // 32 Bit Z-Buffer (Depth Buffer)
32, // 32 Bit Z-Buffer (Depth Buffer)
0, // No Stencil Buffer
0, // No Auxiliary Buffer
PFD_MAIN_PLANE, // Main Drawing Layer
0, // Reserved
0, 0, 0 // Layer Masks Ignored
0, 0, 0 // Layer Masks Ignored
};
hGLDC = GetDC(hWnd);
@@ -915,7 +919,7 @@ namespace
window->hGLRC = NULL;
}
if (window->dc)
if (window->dc)
{
ReleaseDC(window->hwnd, window->dc);
window->dc = NULL;
@@ -935,7 +939,7 @@ namespace
if (!wglMakeCurrent(window->dc, window->hGLRC))
CV_ERROR( CV_OpenGlApiCallError, "Can't Activate The GL Rendering Context" );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (window->glDrawCallback)
window->glDrawCallback(window->glDrawData);
@@ -1009,7 +1013,7 @@ CV_IMPL int cvNamedWindow( const char* name, int flags )
ShowWindow(mainhWnd, SW_SHOW);
//YV- remove one border by changing the style
//YV- remove one border by changing the style
hWnd = CreateWindow("HighGUI class", "", (defStyle & ~WS_SIZEBOX) | WS_CHILD, CW_USEDEFAULT, 0, rect.width, rect.height, mainhWnd, 0, hg_hinstance, 0);
if( !hWnd )
CV_ERROR( CV_StsError, "Frame window can not be created" );
@@ -1400,16 +1404,16 @@ cvShowImage( const char* name, const CvArr* arr )
CV_ERROR( CV_StsNullPtr, "NULL name" );
window = icvFindWindowByName(name);
if(!window)
{
if(!window)
{
#ifndef HAVE_OPENGL
cvNamedWindow(name, CV_WINDOW_AUTOSIZE);
cvNamedWindow(name, CV_WINDOW_AUTOSIZE);
#else
cvNamedWindow(name, CV_WINDOW_AUTOSIZE | CV_WINDOW_OPENGL);
cvNamedWindow(name, CV_WINDOW_AUTOSIZE | CV_WINDOW_OPENGL);
#endif
window = icvFindWindowByName(name);
}
window = icvFindWindowByName(name);
}
if( !window || !arr )
EXIT; // keep silence here.
@@ -1467,6 +1471,7 @@ cvShowImage( const char* name, const CvArr* arr )
__END__;
}
#if 0
CV_IMPL void
cvShowImageHWND(HWND w_hWnd, const CvArr* arr)
{
@@ -1494,7 +1499,7 @@ cvShowImageHWND(HWND w_hWnd, const CvArr* arr)
if( CV_IS_IMAGE_HDR( arr ) )
origin = ((IplImage*)arr)->origin;
CV_CALL( image = cvGetMat( arr, &stub ) );
CV_CALL( image = cvGetMat( arr, &stub ) );
if ( hdc )
{
@@ -1512,7 +1517,7 @@ cvShowImageHWND(HWND w_hWnd, const CvArr* arr)
dst_ptr = bmp.bmBits;
}
if( size.cx != image->width || size.cy != image->height || channels != channels0 )
if( size.cx != image->width || size.cy != image->height || channels != channels0 )
{
changed_size = true;
@@ -1544,6 +1549,7 @@ cvShowImageHWND(HWND w_hWnd, const CvArr* arr)
__END__;
}
#endif
CV_IMPL void cvResizeWindow(const char* name, int width, int height )
{
@@ -1666,7 +1672,7 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
// Snap window to screen edges with multi-monitor support. // Adi Shavit
LPWINDOWPOS pos = (LPWINDOWPOS)lParam;
RECT rect;
GetWindowRect(window->frame, &rect);
@@ -1679,15 +1685,15 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
const int SNAP_DISTANCE = 15;
if (abs(pos->x - mi.rcMonitor.left) <= SNAP_DISTANCE)
if (abs(pos->x - mi.rcMonitor.left) <= SNAP_DISTANCE)
pos->x = mi.rcMonitor.left; // snap to left edge
else
else
if (abs(pos->x + pos->cx - mi.rcMonitor.right) <= SNAP_DISTANCE)
pos->x = mi.rcMonitor.right - pos->cx; // snap to right edge
if (abs(pos->y - mi.rcMonitor.top) <= SNAP_DISTANCE)
pos->y = mi.rcMonitor.top; // snap to top edge
else
else
if (abs(pos->y + pos->cy - mi.rcMonitor.bottom) <= SNAP_DISTANCE)
pos->y = mi.rcMonitor.bottom - pos->cy; // snap to bottom edge
}
@@ -1848,9 +1854,9 @@ static LRESULT CALLBACK HighGUIProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
EndPaint(hwnd, &paint);
}
#ifdef HAVE_OPENGL
else if(window->useGl)
else if(window->useGl)
{
drawGl(window);
drawGl(window);
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
#endif

View File

@@ -64,18 +64,18 @@ icvMinAreaState;
// Parameters:
// points - convex hull vertices ( any orientation )
// n - number of vertices
// mode - concrete application of algorithm
// can be CV_CALIPERS_MAXDIST or
// CV_CALIPERS_MINAREARECT
// mode - concrete application of algorithm
// can be CV_CALIPERS_MAXDIST or
// CV_CALIPERS_MINAREARECT
// left, bottom, right, top - indexes of extremal points
// out - output info.
// In case CV_CALIPERS_MAXDIST it points to float value -
// In case CV_CALIPERS_MAXDIST it points to float value -
// maximal height of polygon.
// In case CV_CALIPERS_MINAREARECT
// ((CvPoint2D32f*)out)[0] - corner
// ((CvPoint2D32f*)out)[0] - corner
// ((CvPoint2D32f*)out)[1] - vector1
// ((CvPoint2D32f*)out)[0] - corner2
//
//
// ^
// |
// vector2 |
@@ -94,15 +94,15 @@ icvRotatingCalipers( CvPoint2D32f* points, int n, int mode, float* out )
{
float minarea = FLT_MAX;
float max_dist = 0;
char buffer[32];
char buffer[32] = {};
int i, k;
CvPoint2D32f* vect = (CvPoint2D32f*)cvAlloc( n * sizeof(vect[0]) );
float* inv_vect_length = (float*)cvAlloc( n * sizeof(inv_vect_length[0]) );
int left = 0, bottom = 0, right = 0, top = 0;
int seq[4] = { -1, -1, -1, -1 };
/* rotating calipers sides will always have coordinates
(a,b) (-b,a) (-a,-b) (b, -a)
/* rotating calipers sides will always have coordinates
(a,b) (-b,a) (-a,-b) (b, -a)
*/
/* this is a first base bector (a,b) initialized by (1,0) */
float orientation = 0;
@@ -111,14 +111,14 @@ icvRotatingCalipers( CvPoint2D32f* points, int n, int mode, float* out )
float left_x, right_x, top_y, bottom_y;
CvPoint2D32f pt0 = points[0];
left_x = right_x = pt0.x;
top_y = bottom_y = pt0.y;
for( i = 0; i < n; i++ )
{
double dx, dy;
if( pt0.x < left_x )
left_x = pt0.x, left = i;
@@ -132,7 +132,7 @@ icvRotatingCalipers( CvPoint2D32f* points, int n, int mode, float* out )
bottom_y = pt0.y, bottom = i;
CvPoint2D32f pt = points[(i+1) & (i+1 < n ? -1 : 0)];
dx = pt.x - pt0.x;
dy = pt.y - pt0.y;
@@ -149,7 +149,7 @@ icvRotatingCalipers( CvPoint2D32f* points, int n, int mode, float* out )
{
double ax = vect[n-1].x;
double ay = vect[n-1].y;
for( i = 0; i < n; i++ )
{
double bx = vect[i].x;
@@ -218,7 +218,7 @@ icvRotatingCalipers( CvPoint2D32f* points, int n, int mode, float* out )
base_b = lead_y;
break;
case 1:
base_a = lead_y;
base_a = lead_y;
base_b = -lead_x;
break;
case 2:
@@ -231,12 +231,12 @@ icvRotatingCalipers( CvPoint2D32f* points, int n, int mode, float* out )
break;
default: assert(0);
}
}
}
/* change base point of main edge */
seq[main_element] += 1;
seq[main_element] = (seq[main_element] == n) ? 0 : seq[main_element];
switch (mode)
{
case CV_CALIPERS_MAXHEIGHT:
@@ -351,7 +351,7 @@ cvMinAreaRect2( const CvArr* array, CvMemStorage* storage )
CvBox2D box;
cv::AutoBuffer<CvPoint2D32f> _points;
CvPoint2D32f* points;
memset(&box, 0, sizeof(box));
int i, n;
@@ -409,7 +409,7 @@ cvMinAreaRect2( const CvArr* array, CvMemStorage* storage )
CV_READ_SEQ_ELEM( points[i], reader );
}
}
if( n > 2 )
{
icvRotatingCalipers( points, n, CV_CALIPERS_MINAREARECT, (float*)out );

View File

@@ -41,14 +41,15 @@
#include "precomp.hpp"
#ifdef WIN32 /* make sure it builds under Linux whenever it is included into Makefile.am or not. */
#if 0
//#ifdef WIN32 /* make sure it builds under Linux whenever it is included into Makefile.am or not. */
//void icvCutContour( CvSeq* current, IplImage* image );
CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* image );
//create lists of segments of all contours from image
CvSeq* cvExtractSingleEdges( IplImage* image, //bw image - it's content will be destroyed by cvFindContours
CvSeq* cvExtractSingleEdges( IplImage* image, //bw image - it's content will be destroyed by cvFindContours
CvMemStorage* storage )
{
CvMemStorage* tmp_storage = cvCreateChildMemStorage( storage );
@@ -57,29 +58,29 @@ CvSeq* cvExtractSingleEdges( IplImage* image, //bw image - it's content will be
cvZero( image );
//iterate through contours
//iterate through tree
//iterate through tree
CvSeq* current = contours;
int number = 0;
int level = 1;
CvSeq* output = 0;
CvSeq* tail_seq = 0;
CvSeq* tail_seq = 0;
//actually this loop can iterates through tree,
//but still we use CV_RETR_LIST it is not useful
while( current )
{
number++;
number++;
//get vertical list of segments for one contour
CvSeq* new_seq = icvCutContourRaster( current, storage, image );
//add this vertical list to horisontal list
if( new_seq )
{
if( tail_seq )
{
tail_seq->h_next = new_seq;
if( tail_seq )
{
tail_seq->h_next = new_seq;
new_seq->h_prev = tail_seq;
tail_seq = new_seq;
}
@@ -90,13 +91,13 @@ CvSeq* cvExtractSingleEdges( IplImage* image, //bw image - it's content will be
}
//iteration through tree
if( current->v_next )
{
if( current->v_next )
{
//goto child
current = current->v_next;
level++;
}
else
else
{
//go parent
while( !current->h_next )
@@ -105,7 +106,7 @@ CvSeq* cvExtractSingleEdges( IplImage* image, //bw image - it's content will be
level--;
if( !level ) break;
}
if( current ) //go brother
current = current->h_next;
}
@@ -114,25 +115,25 @@ CvSeq* cvExtractSingleEdges( IplImage* image, //bw image - it's content will be
//free temporary memstorage with initial contours
cvReleaseMemStorage( &tmp_storage );
return output;
return output;
}
//makes vertical list of segments for 1 contour
CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* image /*tmp image*/)
{
//iplSet(image, 0 ); // this can cause double edges if two contours have common edge
// for example if object is circle with 1 pixel width
// to remove such problem - remove this iplSet
// for example if object is circle with 1 pixel width
// to remove such problem - remove this iplSet
//approx contour by single edges
CvSeqReader reader;
CvSeqWriter writer;
int writing = 0;
cvStartReadSeq( current, &reader, 0 );
//below line just to avoid warning
cvStartWriteSeq( current->flags, sizeof(CvContour), sizeof(CvPoint), storage, &writer );
CvSeq* output = 0;
CvSeq* tail = 0;
@@ -147,7 +148,7 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
//mark point
((uchar*)image->imageData)[image->widthStep * cur.y + cur.x]++;
assert( ((uchar*)image->imageData)[image->widthStep * cur.y + cur.x] != 255 );
}
//second pass - create separate edges
@@ -161,22 +162,22 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
uchar flag = image->imageData[image->widthStep * cur.y + cur.x];
if( flag != 255 && flag < 3) //
{
if(!writing)
if(!writing)
{
cvStartWriteSeq( current->flags, sizeof(CvContour), sizeof(CvPoint), storage, &writer );
writing = 1 ;
writing = 1 ;
}
//mark point
if( flag < 3 ) ((uchar*)image->imageData)[image->widthStep * cur.y + cur.x] = 255;
//add it to another seq
CV_WRITE_SEQ_ELEM( cur, writer );
}
else
{
//exclude this point from contour
if( writing )
if( writing )
{
CvSeq* newseq = cvEndWriteSeq( &writer );
writing = 0;
@@ -191,7 +192,7 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
{
output = tail = newseq;
}
}
}
}
}
@@ -211,7 +212,7 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
{
output = tail = newseq;
}
}
}
return output;
@@ -224,12 +225,12 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
//approx contour by single edges
CvSeqReader reader;
CvSeqReader rev_reader;
cvStartReadSeq( current, &reader, 0 );
int64* cur_pt = (int64*)reader.ptr;
int64* prev_pt = (int64*)reader.prev_elem;
//search for point a in aba position
for( int i = 0; i < current->total; i++ )
{
@@ -240,7 +241,7 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
{
//return to prev pos
CV_PREV_SEQ_ELEM( sizeof(int64), reader );
//this point is end of edge
//start going both directions and collect edge
@@ -248,7 +249,7 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
int pos = cvGetSeqReaderPos( &reader );
cvSetSeqReaderPos( &rev_reader, pos );
//walk in both directions
while(1);
@@ -259,10 +260,10 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
}
}
*/
#endif /* WIN32 */

View File

@@ -446,15 +446,15 @@ static int getPathOfFeaturePyramid(IplImage * image,
CvLSVMFeatureMap *map;
IplImage *scaleTmp;
float scale;
int i, err;
int i;
for(i = 0; i < numStep; i++)
{
scale = 1.0f / powf(step, (float)i);
scaleTmp = resize_opencv (image, scale);
err = getFeatureMaps(scaleTmp, sideLength, &map);
err = normalizeAndTruncate(map, VAL_OF_TRUNCATE);
err = PCAFeatureMaps(map);
getFeatureMaps(scaleTmp, sideLength, &map);
normalizeAndTruncate(map, VAL_OF_TRUNCATE);
PCAFeatureMaps(map);
(*maps)->pyramid[startIndex + i] = map;
cvReleaseImage(&scaleTmp);
}/*for(i = 0; i < numStep; i++)*/

View File

@@ -560,7 +560,7 @@ int searchObjectThresholdSomeComponents(const CvLSVMFeaturePyramid *H,
float **score, int *kPoints,
int numThreads)
{
int error = 0;
//int error = 0;
int i, j, s, f, componentIndex;
unsigned int maxXBorder, maxYBorder;
CvPoint **pointsArr, **oppPointsArr, ***partsDisplacementArr;
@@ -576,14 +576,14 @@ int searchObjectThresholdSomeComponents(const CvLSVMFeaturePyramid *H,
partsDisplacementArr = (CvPoint ***)malloc(sizeof(CvPoint **) * kComponents);
// Getting maximum filter dimensions
error = getMaxFilterDims(filters, kComponents, kPartFilters, &maxXBorder, &maxYBorder);
/*error = */getMaxFilterDims(filters, kComponents, kPartFilters, &maxXBorder, &maxYBorder);
componentIndex = 0;
*kPoints = 0;
// For each component perform searching
for (i = 0; i < kComponents; i++)
{
#ifdef HAVE_TBB
error = searchObjectThreshold(H, &(filters[componentIndex]), kPartFilters[i],
/*error = */searchObjectThreshold(H, &(filters[componentIndex]), kPartFilters[i],
b[i], maxXBorder, maxYBorder, scoreThreshold,
&(pointsArr[i]), &(levelsArr[i]), &(kPointsArr[i]),
&(scoreArr[i]), &(partsDisplacementArr[i]), numThreads);

View File

@@ -534,12 +534,12 @@ void parserPFilterS (FILE * xmlf, int p, CvLSVMFilterObject *** model, int *last
int tag;
int tagVal;
char ch;
int i,j;
char buf[1024];
int /*i,*/j;
//char buf[1024];
char tagBuf[1024];
//printf("<PartFilters>\n");
i = 0;
//i = 0;
j = 0;
st = 0;
tag = 0;
@@ -566,10 +566,10 @@ void parserPFilterS (FILE * xmlf, int p, CvLSVMFilterObject *** model, int *last
N_path++;
}
tag = 0;
i = 0;
//i = 0;
}else{
if((tag == 0)&& (st == 1)){
buf[i] = ch; i++;
//buf[i] = ch; i++;
}else{
tagBuf[j] = ch; j++;
}
@@ -582,12 +582,12 @@ void parserComp (FILE * xmlf, int p, int *N_comp, CvLSVMFilterObject *** model,
int tag;
int tagVal;
char ch;
int i,j;
char buf[1024];
int /*i,*/j;
//char buf[1024];
char tagBuf[1024];
//printf("<Component> %d\n", *N_comp);
i = 0;
//i = 0;
j = 0;
st = 0;
tag = 0;
@@ -616,10 +616,10 @@ void parserComp (FILE * xmlf, int p, int *N_comp, CvLSVMFilterObject *** model,
parserPFilterS (xmlf, p, model, last, max);
}
tag = 0;
i = 0;
//i = 0;
}else{
if((tag == 0)&& (st == 1)){
buf[i] = ch; i++;
//buf[i] = ch; i++;
}else{
tagBuf[j] = ch; j++;
}
@@ -726,12 +726,12 @@ void parserModel(FILE * xmlf, CvLSVMFilterObject *** model, int *last, int *max,
}//namespace
int LSVMparser(const char * filename, CvLSVMFilterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score){
int st = 0;
//int st = 0;
int tag;
char ch;
int i,j;
int /*i,*/j;
FILE *xmlf;
char buf[1024];
//char buf[1024];
char tagBuf[1024];
(*max) = 10;
@@ -744,9 +744,9 @@ int LSVMparser(const char * filename, CvLSVMFilterObject *** model, int *last, i
if(xmlf == NULL)
return LSVM_PARSER_FILE_NOT_FOUND;
i = 0;
//i = 0;
j = 0;
st = 0;
//st = 0;
tag = 0;
while(!feof(xmlf)){
ch = (char)fgetc( xmlf );
@@ -757,7 +757,7 @@ int LSVMparser(const char * filename, CvLSVMFilterObject *** model, int *last, i
}else {
if(ch == '>'){
tag = 0;
i = 0;
//i = 0;
tagBuf[j ] = ch;
tagBuf[j + 1] = '\0';
if(getTeg(tagBuf) == MODEL){
@@ -765,7 +765,7 @@ int LSVMparser(const char * filename, CvLSVMFilterObject *** model, int *last, i
}
}else{
if(tag == 0){
buf[i] = ch; i++;
//buf[i] = ch; i++;
}else{
tagBuf[j] = ch; j++;
}

View File

@@ -23,7 +23,7 @@
*/
int convolution(const CvLSVMFilterObject *Fi, const CvLSVMFeatureMap *map, float *f)
{
int n1, m1, n2, m2, p, size, diff1, diff2;
int n1, m1, n2, m2, p, /*size,*/ diff1, diff2;
int i1, i2, j1, j2, k;
float tmp_f1, tmp_f2, tmp_f3, tmp_f4;
float *pMap = NULL;
@@ -37,7 +37,7 @@ int convolution(const CvLSVMFilterObject *Fi, const CvLSVMFeatureMap *map, float
diff1 = n1 - n2 + 1;
diff2 = m1 - m2 + 1;
size = diff1 * diff2;
//size = diff1 * diff2;
for (j1 = diff2 - 1; j1 >= 0; j1--)
{
@@ -333,7 +333,7 @@ int filterDispositionLevel(const CvLSVMFilterObject *Fi, const CvLSVMFeatureMap
float **scoreFi,
int **pointsX, int **pointsY)
{
int n1, m1, n2, m2, p, size, diff1, diff2;
int n1, m1, n2, m2, /*p,*/ size, diff1, diff2;
float *f;
int i1, j1;
int res;
@@ -342,7 +342,7 @@ int filterDispositionLevel(const CvLSVMFilterObject *Fi, const CvLSVMFeatureMap
m1 = pyramid->sizeX;
n2 = Fi->sizeY;
m2 = Fi->sizeX;
p = pyramid->numFeatures;
//p = pyramid->numFeatures;
(*scoreFi) = NULL;
(*pointsX) = NULL;
(*pointsY) = NULL;
@@ -418,7 +418,7 @@ int filterDispositionLevelFFT(const CvLSVMFilterObject *Fi, const CvLSVMFftImage
float **scoreFi,
int **pointsX, int **pointsY)
{
int n1, m1, n2, m2, p, size, diff1, diff2;
int n1, m1, n2, m2, /*p,*/ size, diff1, diff2;
float *f;
int i1, j1;
int res;
@@ -428,7 +428,7 @@ int filterDispositionLevelFFT(const CvLSVMFilterObject *Fi, const CvLSVMFftImage
m1 = featMapImage->dimX;
n2 = Fi->sizeY;
m2 = Fi->sizeX;
p = featMapImage->numFeatures;
//p = featMapImage->numFeatures;
(*scoreFi) = NULL;
(*pointsX) = NULL;
(*pointsY) = NULL;
@@ -611,7 +611,7 @@ int maxFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n,
float *score, CvPoint **points,
int *kPoints, CvPoint ***partsDisplacement)
{
int i, j, k, dimX, dimY, nF0, mF0, p;
int i, j, k, dimX, dimY, nF0, mF0/*, p*/;
int diff1, diff2, index, last, partsLevel;
CvLSVMFilterDisposition **disposition;
float *f;
@@ -639,7 +639,7 @@ int maxFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n,
dimY = H->pyramid[level]->sizeY;
// Number of features
p = H->pyramid[level]->numFeatures;
//p = H->pyramid[level]->numFeatures;
// Getting dimension of root filter
nF0 = all_F[0]->sizeY;
@@ -860,7 +860,7 @@ int thresholdFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n,
float **score, CvPoint **points, int *kPoints,
CvPoint ***partsDisplacement)
{
int i, j, k, dimX, dimY, nF0, mF0, p;
int i, j, k, dimX, dimY, nF0, mF0/*, p*/;
int diff1, diff2, index, last, partsLevel;
CvLSVMFilterDisposition **disposition;
float *f;
@@ -887,7 +887,7 @@ int thresholdFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n,
dimY = H->pyramid[level]->sizeY;
// Number of features
p = H->pyramid[level]->numFeatures;
//p = H->pyramid[level]->numFeatures;
// Getting dimension of root filter
nF0 = all_F[0]->sizeY;

View File

@@ -56,12 +56,12 @@ class CV_EXPORTS Estimator
public:
virtual ~Estimator() {}
void operator ()(const std::vector<ImageFeatures> &features, const std::vector<MatchesInfo> &pairwise_matches,
void operator ()(const std::vector<ImageFeatures> &features, const std::vector<MatchesInfo> &pairwise_matches,
std::vector<CameraParams> &cameras)
{ estimate(features, pairwise_matches, cameras); }
protected:
virtual void estimate(const std::vector<ImageFeatures> &features, const std::vector<MatchesInfo> &pairwise_matches,
virtual void estimate(const std::vector<ImageFeatures> &features, const std::vector<MatchesInfo> &pairwise_matches,
std::vector<CameraParams> &cameras) = 0;
};
@@ -72,8 +72,8 @@ public:
HomographyBasedEstimator(bool is_focals_estimated = false)
: is_focals_estimated_(is_focals_estimated) {}
private:
void estimate(const std::vector<ImageFeatures> &features, const std::vector<MatchesInfo> &pairwise_matches,
private:
void estimate(const std::vector<ImageFeatures> &features, const std::vector<MatchesInfo> &pairwise_matches,
std::vector<CameraParams> &cameras);
bool is_focals_estimated_;
@@ -84,10 +84,10 @@ class CV_EXPORTS BundleAdjusterBase : public Estimator
{
public:
const Mat refinementMask() const { return refinement_mask_.clone(); }
void setRefinementMask(const Mat &mask)
{
void setRefinementMask(const Mat &mask)
{
CV_Assert(mask.type() == CV_8U && mask.size() == Size(3, 3));
refinement_mask_ = mask.clone();
refinement_mask_ = mask.clone();
}
double confThresh() const { return conf_thresh_; }
@@ -97,17 +97,17 @@ public:
void setTermCriteria(const CvTermCriteria& term_criteria) { term_criteria_ = term_criteria; }
protected:
BundleAdjusterBase(int num_params_per_cam, int num_errs_per_measurement)
: num_params_per_cam_(num_params_per_cam),
num_errs_per_measurement_(num_errs_per_measurement)
{
BundleAdjusterBase(int num_params_per_cam, int num_errs_per_measurement)
: num_params_per_cam_(num_params_per_cam),
num_errs_per_measurement_(num_errs_per_measurement)
{
setRefinementMask(Mat::ones(3, 3, CV_8U));
setConfThresh(1.);
setConfThresh(1.);
setTermCriteria(cvTermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 1000, DBL_EPSILON));
}
// Runs bundle adjustment
virtual void estimate(const std::vector<ImageFeatures> &features,
virtual void estimate(const std::vector<ImageFeatures> &features,
const std::vector<MatchesInfo> &pairwise_matches,
std::vector<CameraParams> &cameras);
@@ -143,7 +143,7 @@ protected:
// Minimizes reprojection error.
// It can estimate focal length, aspect ratio, principal point.
// It can estimate focal length, aspect ratio, principal point.
// You can affect only on them via the refinement mask.
class CV_EXPORTS BundleAdjusterReproj : public BundleAdjusterBase
{
@@ -177,7 +177,7 @@ private:
};
enum CV_EXPORTS WaveCorrectKind
enum WaveCorrectKind
{
WAVE_CORRECT_HORIZ,
WAVE_CORRECT_VERT
@@ -193,10 +193,10 @@ void CV_EXPORTS waveCorrect(std::vector<Mat> &rmats, WaveCorrectKind kind);
std::string CV_EXPORTS matchesGraphAsString(std::vector<std::string> &pathes, std::vector<MatchesInfo> &pairwise_matches,
float conf_threshold);
std::vector<int> CV_EXPORTS leaveBiggestComponent(std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches,
std::vector<int> CV_EXPORTS leaveBiggestComponent(std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches,
float conf_threshold);
void CV_EXPORTS findMaxSpanningTree(int num_images, const std::vector<MatchesInfo> &pairwise_matches,
void CV_EXPORTS findMaxSpanningTree(int num_images, const std::vector<MatchesInfo> &pairwise_matches,
Graph &span_tree, std::vector<int> &centers);
} // namespace detail

View File

@@ -33,7 +33,6 @@ PERF_TEST_P(stitch, a123, TEST_DETECTORS)
imgs.push_back( imread( getDataPath("stitching/a2.jpg") ) );
imgs.push_back( imread( getDataPath("stitching/a3.jpg") ) );
Stitcher::Status status;
Ptr<detail::FeaturesFinder> featuresFinder = GetParam() == "orb"
? (detail::FeaturesFinder*)new detail::OrbFeaturesFinder()
: (detail::FeaturesFinder*)new detail::SurfFeaturesFinder();
@@ -53,7 +52,7 @@ PERF_TEST_P(stitch, a123, TEST_DETECTORS)
stitcher.setRegistrationResol(WORK_MEGAPIX);
startTimer();
status = stitcher.stitch(imgs, pano);
stitcher.stitch(imgs, pano);
stopTimer();
}
}
@@ -66,7 +65,6 @@ PERF_TEST_P(stitch, b12, TEST_DETECTORS)
imgs.push_back( imread( getDataPath("stitching/b1.jpg") ) );
imgs.push_back( imread( getDataPath("stitching/b2.jpg") ) );
Stitcher::Status status;
Ptr<detail::FeaturesFinder> featuresFinder = GetParam() == "orb"
? (detail::FeaturesFinder*)new detail::OrbFeaturesFinder()
: (detail::FeaturesFinder*)new detail::SurfFeaturesFinder();
@@ -86,7 +84,7 @@ PERF_TEST_P(stitch, b12, TEST_DETECTORS)
stitcher.setRegistrationResol(WORK_MEGAPIX);
startTimer();
status = stitcher.stitch(imgs, pano);
stitcher.stitch(imgs, pano);
stopTimer();
}
}

View File

@@ -82,7 +82,7 @@ void GainCompensator::feed(const vector<Point> &corners, const vector<Mat> &imag
Mat_<int> N(num_images, num_images); N.setTo(0);
Mat_<double> I(num_images, num_images); I.setTo(0);
Rect dst_roi = resultRoi(corners, images);
//Rect dst_roi = resultRoi(corners, images);
Mat subimg1, subimg2;
Mat_<uchar> submask1, submask2, intersect;
@@ -190,7 +190,7 @@ void BlocksGainCompensator::feed(const vector<Point> &corners, const vector<Mat>
block_corners.push_back(corners[img_idx] + bl_tl);
block_images.push_back(images[img_idx](Rect(bl_tl, bl_br)));
block_masks.push_back(make_pair(masks[img_idx].first(Rect(bl_tl, bl_br)),
block_masks.push_back(make_pair(masks[img_idx].first(Rect(bl_tl, bl_br)),
masks[img_idx].second));
}
}
@@ -201,7 +201,7 @@ void BlocksGainCompensator::feed(const vector<Point> &corners, const vector<Mat>
vector<double> gains = compensator.gains();
gain_maps_.resize(num_images);
Mat_<float> ker(1, 3);
Mat_<float> ker(1, 3);
ker(0,0) = 0.25; ker(0,1) = 0.5; ker(0,2) = 0.25;
int bl_idx = 0;
@@ -213,7 +213,7 @@ void BlocksGainCompensator::feed(const vector<Point> &corners, const vector<Mat>
for (int by = 0; by < bl_per_img.height; ++by)
for (int bx = 0; bx < bl_per_img.width; ++bx, ++bl_idx)
gain_maps_[img_idx](by, bx) = static_cast<float>(gains[bl_idx]);
sepFilter2D(gain_maps_[img_idx], gain_maps_[img_idx], CV_32F, ker, ker);
sepFilter2D(gain_maps_[img_idx], gain_maps_[img_idx], CV_32F, ker, ker);
}

View File

@@ -206,7 +206,7 @@ Stitcher::Status Stitcher::composePanorama(InputArray images, OutputArray pano)
Mat img_warped, img_warped_s;
Mat dilated_mask, seam_mask, mask, mask_warped;
double compose_seam_aspect = 1;
//double compose_seam_aspect = 1;
double compose_work_aspect = 1;
bool is_blender_prepared = false;
@@ -227,7 +227,7 @@ Stitcher::Status Stitcher::composePanorama(InputArray images, OutputArray pano)
is_compose_scale_set = true;
// Compute relative scales
compose_seam_aspect = compose_scale / seam_scale_;
//compose_seam_aspect = compose_scale / seam_scale_;
compose_work_aspect = compose_scale / work_scale_;
// Update warped image scale

View File

@@ -38,6 +38,9 @@
#ifndef GTEST_USES_SIMPLE_RE
# define GTEST_USES_SIMPLE_RE 0
#endif
#ifndef GTEST_USES_POSIX_RE
# define GTEST_USES_POSIX_RE 0
#endif
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wmissing-declarations"
#endif

View File

@@ -412,19 +412,22 @@
// <stddef.h>.
# include <regex.h> // NOLINT
# define GTEST_USES_POSIX_RE 1
# define GTEST_USES_POSIX_RE 1
# define GTEST_USES_SIMPLE_RE 0
#elif GTEST_OS_WINDOWS
// <regex.h> is not available on Windows. Use our own simple regex
// implementation instead.
# define GTEST_USES_SIMPLE_RE 1
# define GTEST_USES_POSIX_RE 0
#else
// <regex.h> may not be available on this platform. Use our own
// simple regex implementation instead.
# define GTEST_USES_SIMPLE_RE 1
# define GTEST_USES_POSIX_RE 0
#endif // GTEST_HAS_POSIX_RE
@@ -1678,6 +1681,8 @@ inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
// Determines whether test results can be streamed to a socket.
#if GTEST_OS_LINUX
# define GTEST_CAN_STREAM_RESULTS_ 1
#else
# define GTEST_CAN_STREAM_RESULTS_ 0
#endif
// Defines some utility macros.