fixed multiple warnings on Windows. fixed bug #1368

This commit is contained in:
Vadim Pisarevsky 2011-10-03 11:00:28 +00:00
parent 78e678b1f8
commit 60ebe2003f
18 changed files with 115 additions and 93 deletions

View File

@ -74,9 +74,7 @@ struct CV_EXPORTS CvMeanShiftTrackerParams
{ {
enum { H = 0, HS = 1, HSV = 2 }; enum { H = 0, HS = 1, HSV = 2 };
CvMeanShiftTrackerParams(int tracking_type = CvMeanShiftTrackerParams::HS, CvMeanShiftTrackerParams(int tracking_type = CvMeanShiftTrackerParams::HS,
CvTermCriteria term_crit = CvTermCriteria()) CvTermCriteria term_crit = CvTermCriteria());
{
}
int tracking_type; int tracking_type;
vector<float> h_range; vector<float> h_range;
@ -105,9 +103,7 @@ struct CV_EXPORTS CvHybridTrackerParams
CvHybridTrackerParams(float ft_tracker_weight = 0.5, float ms_tracker_weight = 0.5, CvHybridTrackerParams(float ft_tracker_weight = 0.5, float ms_tracker_weight = 0.5,
CvFeatureTrackerParams ft_params = CvFeatureTrackerParams(), CvFeatureTrackerParams ft_params = CvFeatureTrackerParams(),
CvMeanShiftTrackerParams ms_params = CvMeanShiftTrackerParams(), CvMeanShiftTrackerParams ms_params = CvMeanShiftTrackerParams(),
CvMotionModel model = CvMotionModel()) CvMotionModel model = CvMotionModel());
{
}
float ft_tracker_weight; float ft_tracker_weight;
float ms_tracker_weight; float ms_tracker_weight;

View File

@ -166,22 +166,22 @@ void BasicRetinaFilter::setLPfilterParameters(const float beta, const float tau,
// check if the spatial constant is correct (avoid 0 value to avoid division by 0) // check if the spatial constant is correct (avoid 0 value to avoid division by 0)
if (desired_k<=0) if (desired_k<=0)
{ {
k=0.001; k=0.001f;
std::cerr<<"BasicRetinaFilter::spatial constant of the low pass filter must be superior to zero !!! correcting parameter setting to 0,001"<<std::endl; std::cerr<<"BasicRetinaFilter::spatial constant of the low pass filter must be superior to zero !!! correcting parameter setting to 0,001"<<std::endl;
} }
float _alpha = k*k; float _alpha = k*k;
float _mu = 0.8; float _mu = 0.8f;
unsigned int tableOffset=filterIndex*3; unsigned int tableOffset=filterIndex*3;
if (k<=0) if (k<=0)
{ {
std::cerr<<"BasicRetinaFilter::spatial filtering coefficient must be superior to zero, correcting value to 0.01"<<std::endl; std::cerr<<"BasicRetinaFilter::spatial filtering coefficient must be superior to zero, correcting value to 0.01"<<std::endl;
_alpha=0.0001; _alpha=0.0001f;
} }
float _temp = (1.0+_beta)/(2.0*_mu*_alpha); float _temp = (1+_beta)/(2*_mu*_alpha);
float _a = _filteringCoeficientsTable[tableOffset] = 1.0 + _temp - sqrt( (1.0+_temp)*(1.0+_temp) - 1.0); float _a = _filteringCoeficientsTable[tableOffset] = 1 + _temp - (float)sqrt( (1.0+_temp)*(1.0+_temp) - 1.0);
_filteringCoeficientsTable[1+tableOffset]=(1.0-_a)*(1.0-_a)*(1.0-_a)*(1.0-_a)/(1.0+_beta); _filteringCoeficientsTable[1+tableOffset]=(1-_a)*(1-_a)*(1-_a)*(1-_a)/(1+_beta);
_filteringCoeficientsTable[2+tableOffset] =tau; _filteringCoeficientsTable[2+tableOffset] =tau;
//std::cout<<"BasicRetinaFilter::normal:"<<(1.0-_a)*(1.0-_a)*(1.0-_a)*(1.0-_a)/(1.0+_beta)<<" -> old:"<<(1-_a)*(1-_a)*(1-_a)*(1-_a)/(1+_beta)<<std::endl; //std::cout<<"BasicRetinaFilter::normal:"<<(1.0-_a)*(1.0-_a)*(1.0-_a)*(1.0-_a)/(1.0+_beta)<<" -> old:"<<(1-_a)*(1-_a)*(1-_a)*(1-_a)/(1+_beta)<<std::endl;
@ -199,7 +199,7 @@ void BasicRetinaFilter::setProgressiveFilterConstants_CentredAccuracy(const floa
} }
float _beta = beta+tau; float _beta = beta+tau;
float _mu=0.8; float _mu=0.8f;
if (alpha0<=0) if (alpha0<=0)
{ {
std::cerr<<"BasicRetinaFilter::spatial filtering coefficient must be superior to zero, correcting value to 0.01"<<std::endl; std::cerr<<"BasicRetinaFilter::spatial filtering coefficient must be superior to zero, correcting value to 0.01"<<std::endl;
@ -208,13 +208,13 @@ void BasicRetinaFilter::setProgressiveFilterConstants_CentredAccuracy(const floa
unsigned int tableOffset=filterIndex*3; unsigned int tableOffset=filterIndex*3;
float _alpha=0.8; float _alpha=0.8f;
float _temp = (1.0+_beta)/(2.0*_mu*_alpha); float _temp = (1+_beta)/(2*_mu*_alpha);
float _a=_filteringCoeficientsTable[tableOffset] = 1.0 + _temp - sqrt( (1.0+_temp)*(1.0+_temp) - 1.0); float _a=_filteringCoeficientsTable[tableOffset] = 1 + _temp - (float)sqrt( (1.0+_temp)*(1.0+_temp) - 1.0);
_filteringCoeficientsTable[tableOffset+1]=(1.0-_a)*(1.0-_a)*(1.0-_a)*(1.0-_a)/(1.0+_beta); _filteringCoeficientsTable[tableOffset+1]=(1-_a)*(1-_a)*(1-_a)*(1-_a)/(1+_beta);
_filteringCoeficientsTable[tableOffset+2] =tau; _filteringCoeficientsTable[tableOffset+2] =tau;
float commonFactor=alpha0/sqrt((float)(_halfNBcolumns*_halfNBcolumns+_halfNBrows*_halfNBrows)+1.0); float commonFactor=alpha0/(float)sqrt(_halfNBcolumns*_halfNBcolumns+_halfNBrows*_halfNBrows+1.0);
//memset(_progressiveSpatialConstant, 255, _filterOutput.getNBpixels()); //memset(_progressiveSpatialConstant, 255, _filterOutput.getNBpixels());
for (unsigned int idColumn=0;idColumn<_halfNBcolumns; ++idColumn) for (unsigned int idColumn=0;idColumn<_halfNBcolumns; ++idColumn)
for (unsigned int idRow=0;idRow<_halfNBrows; ++idRow) for (unsigned int idRow=0;idRow<_halfNBrows; ++idRow)
@ -258,16 +258,16 @@ void BasicRetinaFilter::setProgressiveFilterConstants_CustomAccuracy(const float
float _beta = beta+tau; float _beta = beta+tau;
float _alpha=k*k; float _alpha=k*k;
float _mu=0.8; float _mu=0.8f;
if (k<=0) if (k<=0)
{ {
std::cerr<<"BasicRetinaFilter::spatial filtering coefficient must be superior to zero, correcting value to 0.01"<<std::endl; std::cerr<<"BasicRetinaFilter::spatial filtering coefficient must be superior to zero, correcting value to 0.01"<<std::endl;
//alpha0=0.0001; //alpha0=0.0001;
} }
unsigned int tableOffset=filterIndex*3; unsigned int tableOffset=filterIndex*3;
float _temp = (1.0+_beta)/(2.0*_mu*_alpha); float _temp = (1+_beta)/(2*_mu*_alpha);
float _a=_filteringCoeficientsTable[tableOffset] = 1.0 + _temp - sqrt( (1.0+_temp)*(1.0+_temp) - 1.0); float _a=_filteringCoeficientsTable[tableOffset] = 1 + _temp - (float)sqrt( (1.0+_temp)*(1.0+_temp) - 1.0);
_filteringCoeficientsTable[tableOffset+1]=(1.0-_a)*(1.0-_a)*(1.0-_a)*(1.0-_a)/(1.0+_beta); _filteringCoeficientsTable[tableOffset+1]=(1-_a)*(1-_a)*(1-_a)*(1-_a)/(1+_beta);
_filteringCoeficientsTable[tableOffset+2] =tau; _filteringCoeficientsTable[tableOffset+2] =tau;
//memset(_progressiveSpatialConstant, 255, _filterOutput.getNBpixels()); //memset(_progressiveSpatialConstant, 255, _filterOutput.getNBpixels());
@ -345,7 +345,7 @@ void BasicRetinaFilter::_localLuminanceAdaptationPosNegValues(const float *input
const float *localLuminancePTR=localLuminance; const float *localLuminancePTR=localLuminance;
const float *inputFramePTR=inputFrame; const float *inputFramePTR=inputFrame;
float *outputFramePTR=outputFrame; float *outputFramePTR=outputFrame;
float factor=_maxInputValue*2/CV_PI; float factor=_maxInputValue*2/(float)CV_PI;
for (register unsigned int IDpixel=0 ; IDpixel<_filterOutput.getNBpixels() ; ++IDpixel, ++inputFramePTR) for (register unsigned int IDpixel=0 ; IDpixel<_filterOutput.getNBpixels() ; ++IDpixel, ++inputFramePTR)
{ {
float X0=*(localLuminancePTR++)*_localLuminanceFactor+_localLuminanceAddon; float X0=*(localLuminancePTR++)*_localLuminanceFactor+_localLuminanceAddon;

View File

@ -267,7 +267,7 @@ public:
* @param maxInputValue: the maximum amplitude value measured after local adaptation processing (c.f. function runFilter_LocalAdapdation & runFilter_LocalAdapdation_autonomous) * @param maxInputValue: the maximum amplitude value measured after local adaptation processing (c.f. function runFilter_LocalAdapdation & runFilter_LocalAdapdation_autonomous)
* @param meanLuminance: the a priori meann luminance of the input data (should be 128 for 8bits images but can vary greatly in case of High Dynamic Range Images (HDRI) * @param meanLuminance: the a priori meann luminance of the input data (should be 128 for 8bits images but can vary greatly in case of High Dynamic Range Images (HDRI)
*/ */
void setV0CompressionParameter(const float v0, const float maxInputValue, const float){ _v0=v0*maxInputValue; _localLuminanceFactor=v0; _localLuminanceAddon=maxInputValue*(1.0-v0); _maxInputValue=maxInputValue;}; void setV0CompressionParameter(const float v0, const float maxInputValue, const float){ _v0=v0*maxInputValue; _localLuminanceFactor=v0; _localLuminanceAddon=maxInputValue*(1-v0); _maxInputValue=maxInputValue;};
/** /**
* update local luminance adaptation setup, initial maxInputValue is kept. This function should be applied for normal local adaptation (not for tone mapping operation) * update local luminance adaptation setup, initial maxInputValue is kept. This function should be applied for normal local adaptation (not for tone mapping operation)
@ -280,7 +280,7 @@ public:
* local luminance adaptation setup, this function should be applied for normal local adaptation (not for tone mapping operation) * local luminance adaptation setup, this function should be applied for normal local adaptation (not for tone mapping operation)
* @param v0: compression effect for the local luminance adaptation processing, set a value between 0.6 and 0.9 for best results, a high value yields to a high compression effect * @param v0: compression effect for the local luminance adaptation processing, set a value between 0.6 and 0.9 for best results, a high value yields to a high compression effect
*/ */
void setV0CompressionParameter(const float v0){ _v0=v0*_maxInputValue; _localLuminanceFactor=v0; _localLuminanceAddon=_maxInputValue*(1.0-v0);}; void setV0CompressionParameter(const float v0){ _v0=v0*_maxInputValue; _localLuminanceFactor=v0; _localLuminanceAddon=_maxInputValue*(1-v0);};
/** /**
* local luminance adaptation setup, this function should be applied for local adaptation applied to tone mapping operation * local luminance adaptation setup, this function should be applied for local adaptation applied to tone mapping operation

View File

@ -97,8 +97,8 @@ RotatedRect CvMeanShiftTracker::updateTrackingWindow(Mat image)
prev_trackwindow = Rect(prev_trackwindow.x - r, prev_trackwindow.y - r, prev_trackwindow.x + r, prev_trackwindow = Rect(prev_trackwindow.x - r, prev_trackwindow.y - r, prev_trackwindow.x + r,
prev_trackwindow.y + r) & Rect(0, 0, cols, rows); prev_trackwindow.y + r) & Rect(0, 0, cols, rows);
prev_center.x = prev_trackwindow.x + prev_trackwindow.width / 2; prev_center.x = (float)(prev_trackwindow.x + prev_trackwindow.width / 2);
prev_center.y = prev_trackwindow.y + prev_trackwindow.height / 2; prev_center.y = (float)(prev_trackwindow.y + prev_trackwindow.height / 2);
#ifdef DEBUG_HYTRACKER #ifdef DEBUG_HYTRACKER
ellipse(image, prev_trackbox, Scalar(0, 0, 255), 1, CV_AA); ellipse(image, prev_trackbox, Scalar(0, 0, 255), 1, CV_AA);

View File

@ -124,7 +124,7 @@ Rect CvFeatureTracker::updateTrackingWindowWithSIFT(Mat image)
matcher->match(prev_desc, curr_desc, matches); matcher->match(prev_desc, curr_desc, matches);
for (int i = 0; i < matches.size(); i++) for (int i = 0; i < (int)matches.size(); i++)
{ {
prev_keys.push_back(prev_keypoints[matches[i].queryIdx].pt); prev_keys.push_back(prev_keypoints[matches[i].queryIdx].pt);
curr_keys.push_back(curr_keypoints[matches[i].trainIdx].pt); curr_keys.push_back(curr_keypoints[matches[i].trainIdx].pt);
@ -132,8 +132,8 @@ Rect CvFeatureTracker::updateTrackingWindowWithSIFT(Mat image)
Mat T = findHomography(prev_keys, curr_keys, CV_LMEDS); Mat T = findHomography(prev_keys, curr_keys, CV_LMEDS);
prev_trackwindow.x += T.at<double> (0, 2); prev_trackwindow.x += cvRound(T.at<double> (0, 2));
prev_trackwindow.y += T.at<double> (1, 2); prev_trackwindow.y += cvRound(T.at<double> (1, 2));
} }
prev_center.x = prev_trackwindow.x; prev_center.x = prev_trackwindow.x;
@ -171,7 +171,7 @@ Rect CvFeatureTracker::updateTrackingWindowWithFlow(Mat image)
Point2f feature0_center(0, 0); Point2f feature0_center(0, 0);
Point2f feature1_center(0, 0); Point2f feature1_center(0, 0);
int goodtracks = 0; int goodtracks = 0;
for (int i = 0; i < features[1].size(); i++) for (int i = 0; i < (int)features[1].size(); i++)
{ {
if (status[i] == 1) if (status[i] == 1)
{ {
@ -213,8 +213,8 @@ Rect CvFeatureTracker::getTrackingWindow()
Point2f CvFeatureTracker::getTrackingCenter() Point2f CvFeatureTracker::getTrackingCenter()
{ {
Point2f center(0, 0); Point2f center(0, 0);
center.x = prev_center.x + prev_trackwindow.width/2.0; center.x = (float)(prev_center.x + prev_trackwindow.width/2.0);
center.y = prev_center.y + prev_trackwindow.height/2.0; center.y = (float)(prev_center.y + prev_trackwindow.height/2.0);
return center; return center;
} }

View File

@ -45,6 +45,23 @@
using namespace cv; using namespace cv;
using namespace std; using namespace std;
CvHybridTrackerParams::CvHybridTrackerParams(float _ft_tracker_weight, float _ms_tracker_weight,
CvFeatureTrackerParams _ft_params,
CvMeanShiftTrackerParams _ms_params,
CvMotionModel)
{
ft_tracker_weight = _ft_tracker_weight;
ms_tracker_weight = _ms_tracker_weight;
ft_params = _ft_params;
ms_params = _ms_params;
}
CvMeanShiftTrackerParams::CvMeanShiftTrackerParams(int _tracking_type, CvTermCriteria _term_crit)
{
tracking_type = _tracking_type;
term_crit = _term_crit;
}
CvHybridTracker::CvHybridTracker() { CvHybridTracker::CvHybridTracker() {
} }
@ -98,7 +115,7 @@ Mat CvHybridTracker::getGaussianProjection(Mat image, int ksize, double sigma,
Mat hist(image.size(), CV_64F); Mat hist(image.size(), CV_64F);
for (int i = 0; i < hist.rows; i++) for (int i = 0; i < hist.rows; i++)
for (int j = 0; j < hist.cols; j++) { for (int j = 0; j < hist.cols; j++) {
int pos = getL2Norm(Point(i, j), center); int pos = cvRound(getL2Norm(Point(i, j), center));
if (pos < ksize / 2.0) if (pos < ksize / 2.0)
hist.at<double> (i, j) = 1.0 - (kernel.at<double> (pos) / max); hist.at<double> (i, j) = 1.0 - (kernel.at<double> (pos) / max);
} }
@ -108,8 +125,8 @@ Mat CvHybridTracker::getGaussianProjection(Mat image, int ksize, double sigma,
void CvHybridTracker::newTracker(Mat image, Rect selection) { void CvHybridTracker::newTracker(Mat image, Rect selection) {
prev_proj = Mat::zeros(image.size(), CV_64FC1); prev_proj = Mat::zeros(image.size(), CV_64FC1);
prev_center = Point2f(selection.x + selection.width / 2.0, selection.y prev_center = Point2f(selection.x + selection.width / 2.0f, selection.y
+ selection.height / 2.0); + selection.height / 2.0f);
prev_window = selection; prev_window = selection;
mstracker->newTrackingWindow(image, selection); mstracker->newTrackingWindow(image, selection);
@ -160,10 +177,10 @@ void CvHybridTracker::updateTracker(Mat image) {
double total_len = ms_len + ft_len; double total_len = ms_len + ft_len;
params.ms_tracker_weight *= (ittr - 1); params.ms_tracker_weight *= (ittr - 1);
params.ms_tracker_weight += (ms_len / total_len); params.ms_tracker_weight += (float)((ms_len / total_len));
params.ms_tracker_weight /= ittr; params.ms_tracker_weight /= ittr;
params.ft_tracker_weight *= (ittr - 1); params.ft_tracker_weight *= (ittr - 1);
params.ft_tracker_weight += (ft_len / total_len); params.ft_tracker_weight += (float)((ft_len / total_len));
params.ft_tracker_weight /= ittr; params.ft_tracker_weight /= ittr;
circle(image, prev_center, 3, Scalar(0, 0, 0), -1, 8); circle(image, prev_center, 3, Scalar(0, 0, 0), -1, 8);
@ -183,7 +200,7 @@ void CvHybridTracker::updateTrackerWithEM(Mat image) {
Mat ms_proj = ms_backproj.mul(ms_distproj); Mat ms_proj = ms_backproj.mul(ms_distproj);
float dist_err = getL2Norm(mstracker->getTrackingCenter(), fttracker->getTrackingCenter()); float dist_err = getL2Norm(mstracker->getTrackingCenter(), fttracker->getTrackingCenter());
Mat ft_gaussproj = getGaussianProjection(image, dist_err, -1, fttracker->getTrackingCenter()); Mat ft_gaussproj = getGaussianProjection(image, cvRound(dist_err), -1, fttracker->getTrackingCenter());
Mat ft_distproj = getDistanceProjection(image, fttracker->getTrackingCenter()); Mat ft_distproj = getDistanceProjection(image, fttracker->getTrackingCenter());
Mat ft_proj = ft_gaussproj.mul(ft_distproj); Mat ft_proj = ft_gaussproj.mul(ft_distproj);
@ -215,8 +232,8 @@ void CvHybridTracker::updateTrackerWithLowPassFilter(Mat image) {
Point2f ft_center = fttracker->getTrackingCenter(); Point2f ft_center = fttracker->getTrackingCenter();
float a = params.low_pass_gain; float a = params.low_pass_gain;
curr_center.x = (1.0 - a) * prev_center.x + a * (params.ms_tracker_weight * ms_track.center.x + params.ft_tracker_weight * ft_center.x); curr_center.x = (1 - a) * prev_center.x + a * (params.ms_tracker_weight * ms_track.center.x + params.ft_tracker_weight * ft_center.x);
curr_center.y = (1.0 - a) * prev_center.y + a * (params.ms_tracker_weight * ms_track.center.y + params.ft_tracker_weight * ft_center.y); curr_center.y = (1 - a) * prev_center.y + a * (params.ms_tracker_weight * ms_track.center.y + params.ft_tracker_weight * ft_center.y);
} }
Rect CvHybridTracker::getTrackingWindow() { Rect CvHybridTracker::getTrackingWindow() {

View File

@ -177,7 +177,7 @@ bool ImageLogPolProjection::_initLogRetinaSampling(const double reductionFactor,
#endif #endif
// setup progressive prefilter that will be applied BEFORE log sampling // setup progressive prefilter that will be applied BEFORE log sampling
setProgressiveFilterConstants_CentredAccuracy(0.0, 0.0, 0.99); setProgressiveFilterConstants_CentredAccuracy(0.f, 0.f, 0.99f);
// (re)create the image output buffer and transform table if the reduction factor changed // (re)create the image output buffer and transform table if the reduction factor changed
_sampledFrame.resize(_outputNBpixels*(1+(unsigned int)_colorModeCapable*2)); _sampledFrame.resize(_outputNBpixels*(1+(unsigned int)_colorModeCapable*2));
@ -338,7 +338,7 @@ bool ImageLogPolProjection::_initLogPolarCortexSampling(const double reductionFa
#endif #endif
// setup progressive prefilter that will be applied BEFORE log sampling // setup progressive prefilter that will be applied BEFORE log sampling
setProgressiveFilterConstants_CentredAccuracy(0.0, 0.0, 0.99); setProgressiveFilterConstants_CentredAccuracy(0.f, 0.f, 0.99f);
// (re)create the image output buffer and transform table if the reduction factor changed // (re)create the image output buffer and transform table if the reduction factor changed
_sampledFrame.resize(_outputNBpixels*(1+(unsigned int)_colorModeCapable*2)); _sampledFrame.resize(_outputNBpixels*(1+(unsigned int)_colorModeCapable*2));

View File

@ -144,7 +144,7 @@ void MagnoRetinaFilter::resize(const unsigned int NBrows, const unsigned int NBc
void MagnoRetinaFilter::setCoefficientsTable(const float parasolCells_beta, const float parasolCells_tau, const float parasolCells_k, const float amacrinCellsTemporalCutFrequency, const float localAdaptIntegration_tau, const float localAdaptIntegration_k ) void MagnoRetinaFilter::setCoefficientsTable(const float parasolCells_beta, const float parasolCells_tau, const float parasolCells_k, const float amacrinCellsTemporalCutFrequency, const float localAdaptIntegration_tau, const float localAdaptIntegration_k )
{ {
_temporalCoefficient=exp(-1.0/amacrinCellsTemporalCutFrequency); _temporalCoefficient=(float)exp(-1.0/amacrinCellsTemporalCutFrequency);
// the first set of parameters is dedicated to the low pass filtering property of the ganglion cells // the first set of parameters is dedicated to the low pass filtering property of the ganglion cells
BasicRetinaFilter::setLPfilterParameters(parasolCells_beta, parasolCells_tau, parasolCells_k, 0); BasicRetinaFilter::setLPfilterParameters(parasolCells_beta, parasolCells_tau, parasolCells_k, 0);
// the second set of parameters is dedicated to the ganglion cells output intergartion for their local adaptation property // the second set of parameters is dedicated to the ganglion cells output intergartion for their local adaptation property

View File

@ -220,7 +220,7 @@ void ParvoRetinaFilter::_OPL_OnOffWaysComputing()
// ON and OFF channels writing step // ON and OFF channels writing step
*(parvocellularOutputON_PTR++)=*(bipolarCellsON_PTR++) = isPositive*pixelDifference; *(parvocellularOutputON_PTR++)=*(bipolarCellsON_PTR++) = isPositive*pixelDifference;
*(parvocellularOutputOFF_PTR++)=*(bipolarCellsOFF_PTR++)= (isPositive-1.0)*pixelDifference; *(parvocellularOutputOFF_PTR++)=*(bipolarCellsOFF_PTR++)= (isPositive-1)*pixelDifference;
} }
} }
} }

View File

@ -299,8 +299,8 @@ void Retina::getMagno(cv::Mat &retinaOutput_magno)
} }
// original API level data accessors // original API level data accessors
void Retina::getMagno(std::valarray<float> &retinaOutput_magno){_retinaFilter->getMovingContours();} void Retina::getMagno(std::valarray<float> &){_retinaFilter->getMovingContours();}
void Retina::getParvo(std::valarray<float> &retinaOutput_parvo){_retinaFilter->getContours();} void Retina::getParvo(std::valarray<float> &){_retinaFilter->getContours();}
// private method called by constructirs // private method called by constructirs
void Retina::_init(const std::string parametersSaveFile, const cv::Size inputSize, const bool colorMode, RETINA_COLORSAMPLINGMETHOD colorSamplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght) void Retina::_init(const std::string parametersSaveFile, const cv::Size inputSize, const bool colorMode, RETINA_COLORSAMPLINGMETHOD colorSamplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght)

View File

@ -77,7 +77,7 @@ namespace cv
// init static values // init static values
static float _LMStoACr1Cr2[]={1.0, 1.0, 0.0, 1.0, -1.0, 0.0, -0.5, -0.5, 1.0}; static float _LMStoACr1Cr2[]={1.0, 1.0, 0.0, 1.0, -1.0, 0.0, -0.5, -0.5, 1.0};
//static double _ACr1Cr2toLMS[]={0.5, 0.5, 0.0, 0.5, -0.5, 0.0, 0.5, 0.0, 1.0}; //static double _ACr1Cr2toLMS[]={0.5, 0.5, 0.0, 0.5, -0.5, 0.0, 0.5, 0.0, 1.0};
static float _LMStoLab[]={0.5774, 0.5774, 0.5774, 0.4082, 0.4082, -0.8165, 0.7071, -0.7071, 0.0}; static float _LMStoLab[]={0.5774f, 0.5774f, 0.5774f, 0.4082f, 0.4082f, -0.8165f, 0.7071f, -0.7071f, 0.f};
// constructor/desctructor // constructor/desctructor
RetinaColor::RetinaColor(const unsigned int NBrows, const unsigned int NBcolumns, const RETINA_COLORSAMPLINGMETHOD samplingMethod) RetinaColor::RetinaColor(const unsigned int NBrows, const unsigned int NBcolumns, const RETINA_COLORSAMPLINGMETHOD samplingMethod)
@ -103,10 +103,10 @@ RetinaColor::RetinaColor(const unsigned int NBrows, const unsigned int NBcolumns
// set default spatio-temporal filter parameters // set default spatio-temporal filter parameters
setLPfilterParameters(0.0, 0.0, 1.5); setLPfilterParameters(0.0, 0.0, 1.5);
setLPfilterParameters(0.0, 0.0, 10.5, 1);// for the low pass filter dedicated to contours energy extraction (demultiplexing process) setLPfilterParameters(0.0, 0.0, 10.5, 1);// for the low pass filter dedicated to contours energy extraction (demultiplexing process)
setLPfilterParameters(0.0, 0.0, 0.9, 2); setLPfilterParameters(0.f, 0.f, 0.9f, 2);
// init default value on image Gradient // init default value on image Gradient
_imageGradient=0.57; _imageGradient=0.57f;
// init color sampling map // init color sampling map
_initColorSampling(); _initColorSampling();
@ -167,7 +167,7 @@ void RetinaColor::_initColorSampling()
{ {
// filling the conversion table for multiplexed <=> demultiplexed frame // filling the conversion table for multiplexed <=> demultiplexed frame
srand(time(NULL)); srand((unsigned)time(NULL));
// preInit cones probabilities // preInit cones probabilities
_pR=_pB=_pG=0; _pR=_pB=_pG=0;
@ -206,7 +206,7 @@ void RetinaColor::_initColorSampling()
{ {
_colorSampling[index] = index+((index%3+(index%_filterOutput.getNBcolumns()))%3)*_filterOutput.getNBpixels(); _colorSampling[index] = index+((index%3+(index%_filterOutput.getNBcolumns()))%3)*_filterOutput.getNBpixels();
} }
_pR=_pB=_pG=1.0/3.0; _pR=_pB=_pG=1.f/3;
break; break;
case RETINA_COLOR_BAYER: // default sets bayer sampling case RETINA_COLOR_BAYER: // default sets bayer sampling
for (unsigned int index=0 ; index<_filterOutput.getNBpixels(); ++index) for (unsigned int index=0 ; index<_filterOutput.getNBpixels(); ++index)
@ -240,7 +240,7 @@ void RetinaColor::_initColorSampling()
unsigned int maxNBpixels=3*_filterOutput.getNBpixels(); unsigned int maxNBpixels=3*_filterOutput.getNBpixels();
register float *colorLocalDensityPTR=&_colorLocalDensity[0]; register float *colorLocalDensityPTR=&_colorLocalDensity[0];
for (unsigned int i=0;i<maxNBpixels;++i, ++colorLocalDensityPTR) for (unsigned int i=0;i<maxNBpixels;++i, ++colorLocalDensityPTR)
*colorLocalDensityPTR=1.0/ *colorLocalDensityPTR; *colorLocalDensityPTR=1.f/ *colorLocalDensityPTR;
#ifdef RETINACOLORDEBUG #ifdef RETINACOLORDEBUG
std::cout<<"INIT _colorLocalDensity max, min: "<<_colorLocalDensity.max()<<", "<<_colorLocalDensity.min()<<std::endl; std::cout<<"INIT _colorLocalDensity max, min: "<<_colorLocalDensity.max()<<", "<<_colorLocalDensity.min()<<std::endl;
@ -476,7 +476,7 @@ void RetinaColor::_interpolateSingleChannelImage111(float *inputOutputBuffer)
for (unsigned int indexc=1 ; indexc<_filterOutput.getNBcolumns()-1; ++indexc) for (unsigned int indexc=1 ; indexc<_filterOutput.getNBcolumns()-1; ++indexc)
{ {
unsigned int index=indexc+indexr*_filterOutput.getNBcolumns(); unsigned int index=indexc+indexr*_filterOutput.getNBcolumns();
inputOutputBuffer[index]=(inputOutputBuffer[index-1]+inputOutputBuffer[index]+inputOutputBuffer[index+1])/3.0; inputOutputBuffer[index]=(inputOutputBuffer[index-1]+inputOutputBuffer[index]+inputOutputBuffer[index+1])/3.f;
} }
} }
for (unsigned int indexc=0 ; indexc<_filterOutput.getNBcolumns(); ++indexc) for (unsigned int indexc=0 ; indexc<_filterOutput.getNBcolumns(); ++indexc)
@ -484,7 +484,7 @@ void RetinaColor::_interpolateSingleChannelImage111(float *inputOutputBuffer)
for (unsigned int indexr=1 ; indexr<_filterOutput.getNBrows()-1; ++indexr) for (unsigned int indexr=1 ; indexr<_filterOutput.getNBrows()-1; ++indexr)
{ {
unsigned int index=indexc+indexr*_filterOutput.getNBcolumns(); unsigned int index=indexc+indexr*_filterOutput.getNBcolumns();
inputOutputBuffer[index]=(inputOutputBuffer[index-_filterOutput.getNBcolumns()]+inputOutputBuffer[index]+inputOutputBuffer[index+_filterOutput.getNBcolumns()])/3.0; inputOutputBuffer[index]=(inputOutputBuffer[index-_filterOutput.getNBcolumns()]+inputOutputBuffer[index]+inputOutputBuffer[index+_filterOutput.getNBcolumns()])/3.f;
} }
} }
} }
@ -497,8 +497,8 @@ void RetinaColor::_interpolateBayerRGBchannels(float *inputOutputBuffer)
{ {
unsigned int indexR=indexc+indexr*_filterOutput.getNBcolumns(); unsigned int indexR=indexc+indexr*_filterOutput.getNBcolumns();
unsigned int indexB=_filterOutput.getDoubleNBpixels()+indexc+1+(indexr+1)*_filterOutput.getNBcolumns(); unsigned int indexB=_filterOutput.getDoubleNBpixels()+indexc+1+(indexr+1)*_filterOutput.getNBcolumns();
inputOutputBuffer[indexR]=(inputOutputBuffer[indexR-1]+inputOutputBuffer[indexR+1])/2.0; inputOutputBuffer[indexR]=(inputOutputBuffer[indexR-1]+inputOutputBuffer[indexR+1])/2.f;
inputOutputBuffer[indexB]=(inputOutputBuffer[indexB-1]+inputOutputBuffer[indexB+1])/2.0; inputOutputBuffer[indexB]=(inputOutputBuffer[indexB-1]+inputOutputBuffer[indexB+1])/2.f;
} }
} }
for (unsigned int indexr=1 ; indexr<_filterOutput.getNBrows()-1; indexr+=2) for (unsigned int indexr=1 ; indexr<_filterOutput.getNBrows()-1; indexr+=2)
@ -507,8 +507,8 @@ void RetinaColor::_interpolateBayerRGBchannels(float *inputOutputBuffer)
{ {
unsigned int indexR=indexc+indexr*_filterOutput.getNBcolumns(); unsigned int indexR=indexc+indexr*_filterOutput.getNBcolumns();
unsigned int indexB=_filterOutput.getDoubleNBpixels()+indexc+1+(indexr+1)*_filterOutput.getNBcolumns(); unsigned int indexB=_filterOutput.getDoubleNBpixels()+indexc+1+(indexr+1)*_filterOutput.getNBcolumns();
inputOutputBuffer[indexR]=(inputOutputBuffer[indexR-_filterOutput.getNBcolumns()]+inputOutputBuffer[indexR+_filterOutput.getNBcolumns()])/2.0; inputOutputBuffer[indexR]=(inputOutputBuffer[indexR-_filterOutput.getNBcolumns()]+inputOutputBuffer[indexR+_filterOutput.getNBcolumns()])/2.f;
inputOutputBuffer[indexB]=(inputOutputBuffer[indexB-_filterOutput.getNBcolumns()]+inputOutputBuffer[indexB+_filterOutput.getNBcolumns()])/2.0; inputOutputBuffer[indexB]=(inputOutputBuffer[indexB-_filterOutput.getNBcolumns()]+inputOutputBuffer[indexB+_filterOutput.getNBcolumns()])/2.f;
} }
} }
@ -516,7 +516,7 @@ void RetinaColor::_interpolateBayerRGBchannels(float *inputOutputBuffer)
for (unsigned int indexc=0 ; indexc<_filterOutput.getNBcolumns(); indexc+=2) for (unsigned int indexc=0 ; indexc<_filterOutput.getNBcolumns(); indexc+=2)
{ {
unsigned int indexG=_filterOutput.getNBpixels()+indexc+(indexr)*_filterOutput.getNBcolumns()+indexr%2; unsigned int indexG=_filterOutput.getNBpixels()+indexc+(indexr)*_filterOutput.getNBcolumns()+indexr%2;
inputOutputBuffer[indexG]=(inputOutputBuffer[indexG-1]+inputOutputBuffer[indexG+1]+inputOutputBuffer[indexG-_filterOutput.getNBcolumns()]+inputOutputBuffer[indexG+_filterOutput.getNBcolumns()])*0.25; inputOutputBuffer[indexG]=(inputOutputBuffer[indexG-1]+inputOutputBuffer[indexG+1]+inputOutputBuffer[indexG-_filterOutput.getNBcolumns()]+inputOutputBuffer[indexG+_filterOutput.getNBcolumns()])*0.25f;
} }
} }
@ -527,7 +527,7 @@ void RetinaColor::_applyRIFfilter(const float *sourceBuffer, float *destinationB
for (unsigned int indexc=1 ; indexc<_filterOutput.getNBcolumns()-1; ++indexc) for (unsigned int indexc=1 ; indexc<_filterOutput.getNBcolumns()-1; ++indexc)
{ {
unsigned int index=indexc+indexr*_filterOutput.getNBcolumns(); unsigned int index=indexc+indexr*_filterOutput.getNBcolumns();
_tempMultiplexedFrame[index]=(4.0*sourceBuffer[index]+sourceBuffer[index-1-_filterOutput.getNBcolumns()]+sourceBuffer[index-1+_filterOutput.getNBcolumns()]+sourceBuffer[index+1-_filterOutput.getNBcolumns()]+sourceBuffer[index+1+_filterOutput.getNBcolumns()])*0.125; _tempMultiplexedFrame[index]=(4.f*sourceBuffer[index]+sourceBuffer[index-1-_filterOutput.getNBcolumns()]+sourceBuffer[index-1+_filterOutput.getNBcolumns()]+sourceBuffer[index+1-_filterOutput.getNBcolumns()]+sourceBuffer[index+1+_filterOutput.getNBcolumns()])*0.125f;
} }
} }
memcpy(destinationBuffer, &_tempMultiplexedFrame[0], sizeof(float)*_filterOutput.getNBpixels()); memcpy(destinationBuffer, &_tempMultiplexedFrame[0], sizeof(float)*_filterOutput.getNBpixels());
@ -536,21 +536,21 @@ void RetinaColor::_applyRIFfilter(const float *sourceBuffer, float *destinationB
void RetinaColor::_getNormalizedContoursImage(const float *inputFrame, float *outputFrame) void RetinaColor::_getNormalizedContoursImage(const float *inputFrame, float *outputFrame)
{ {
float maxValue=0; float maxValue=0;
float normalisationFactor=1.0/3.0; float normalisationFactor=1.f/3;
for (unsigned int indexr=1 ; indexr<_filterOutput.getNBrows()-1; ++indexr) for (unsigned int indexr=1 ; indexr<_filterOutput.getNBrows()-1; ++indexr)
{ {
for (unsigned int indexc=1 ; indexc<_filterOutput.getNBcolumns()-1; ++indexc) for (unsigned int indexc=1 ; indexc<_filterOutput.getNBcolumns()-1; ++indexc)
{ {
unsigned int index=indexc+indexr*_filterOutput.getNBcolumns(); unsigned int index=indexc+indexr*_filterOutput.getNBcolumns();
outputFrame[index]=normalisationFactor*fabs(8.0*inputFrame[index]-inputFrame[index-1]-inputFrame[index+1]-inputFrame[index-_filterOutput.getNBcolumns()]-inputFrame[index+_filterOutput.getNBcolumns()]-inputFrame[index-1-_filterOutput.getNBcolumns()]-inputFrame[index-1+_filterOutput.getNBcolumns()]-inputFrame[index+1-_filterOutput.getNBcolumns()]-inputFrame[index+1+_filterOutput.getNBcolumns()]); outputFrame[index]=normalisationFactor*fabs(8.f*inputFrame[index]-inputFrame[index-1]-inputFrame[index+1]-inputFrame[index-_filterOutput.getNBcolumns()]-inputFrame[index+_filterOutput.getNBcolumns()]-inputFrame[index-1-_filterOutput.getNBcolumns()]-inputFrame[index-1+_filterOutput.getNBcolumns()]-inputFrame[index+1-_filterOutput.getNBcolumns()]-inputFrame[index+1+_filterOutput.getNBcolumns()]);
if (outputFrame[index]>maxValue) if (outputFrame[index]>maxValue)
maxValue=outputFrame[index]; maxValue=outputFrame[index];
} }
} }
normalisationFactor=1.0/maxValue; normalisationFactor=1.f/maxValue;
// normalisation [0, 1] // normalisation [0, 1]
for (unsigned int indexp=1 ; indexp<_filterOutput.getNBrows()-1; ++indexp) for (unsigned int indexp=1 ; indexp<_filterOutput.getNBrows()-1; ++indexp)
outputFrame[indexp]=outputFrame[indexp]*normalisationFactor; outputFrame[indexp]=outputFrame[indexp]*normalisationFactor;
} }
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
@ -561,7 +561,7 @@ void RetinaColor::_adaptiveSpatialLPfilter(const float *inputFrame, float *outpu
{ {
/**********/ /**********/
_gain = (1-0.57)*(1-0.57)*(1-0.06)*(1-0.06); _gain = (1-0.57f)*(1-0.57f)*(1-0.06f)*(1-0.06f);
// launch the serie of 1D directional filters in order to compute the 2D low pass filter // launch the serie of 1D directional filters in order to compute the 2D low pass filter
_adaptiveHorizontalCausalFilter_addInput(inputFrame, outputFrame, 0, _filterOutput.getNBrows()); _adaptiveHorizontalCausalFilter_addInput(inputFrame, outputFrame, 0, _filterOutput.getNBrows());
@ -669,19 +669,19 @@ void RetinaColor::_computeGradient(const float *luminance)
const float verticalGrad_n=fabs(luminance[pixelIndex+2*_filterOutput.getNBcolumns()]-luminance[pixelIndex]); const float verticalGrad_n=fabs(luminance[pixelIndex+2*_filterOutput.getNBcolumns()]-luminance[pixelIndex]);
const float horizontalGrad_n=fabs(luminance[pixelIndex+2]-luminance[pixelIndex]); const float horizontalGrad_n=fabs(luminance[pixelIndex+2]-luminance[pixelIndex]);
const float horizontalGradient=0.5*horizontalGrad+0.25*(horizontalGrad_p+horizontalGrad_n); const float horizontalGradient=0.5f*horizontalGrad+0.25f*(horizontalGrad_p+horizontalGrad_n);
const float verticalGradient=0.5*verticalGrad+0.25*(verticalGrad_p+verticalGrad_n); const float verticalGradient=0.5f*verticalGrad+0.25f*(verticalGrad_p+verticalGrad_n);
// compare local gradient means and fill the appropriate filtering coefficient value that will be used in adaptative filters // compare local gradient means and fill the appropriate filtering coefficient value that will be used in adaptative filters
if (horizontalGradient<verticalGradient) if (horizontalGradient<verticalGradient)
{ {
_imageGradient[pixelIndex+_filterOutput.getNBpixels()]=0.06; _imageGradient[pixelIndex+_filterOutput.getNBpixels()]=0.06f;
_imageGradient[pixelIndex]=0.57; _imageGradient[pixelIndex]=0.57f;
} }
else else
{ {
_imageGradient[pixelIndex+_filterOutput.getNBpixels()]=0.57; _imageGradient[pixelIndex+_filterOutput.getNBpixels()]=0.57f;
_imageGradient[pixelIndex]=0.06; _imageGradient[pixelIndex]=0.06f;
} }
} }
} }

View File

@ -201,7 +201,7 @@ namespace cv
// fill _hybridParvoMagnoCoefTable // fill _hybridParvoMagnoCoefTable
int i, j, halfRows=_photoreceptorsPrefilter.getNBrows()/2, halfColumns=_photoreceptorsPrefilter.getNBcolumns()/2; int i, j, halfRows=_photoreceptorsPrefilter.getNBrows()/2, halfColumns=_photoreceptorsPrefilter.getNBcolumns()/2;
float *hybridParvoMagnoCoefTablePTR= &_retinaParvoMagnoMapCoefTable[0]; float *hybridParvoMagnoCoefTablePTR= &_retinaParvoMagnoMapCoefTable[0];
float minDistance=(float)MIN(halfRows, halfColumns)*0.7; float minDistance=MIN(halfRows, halfColumns)*0.7f;
for (i=0;i<(int)_photoreceptorsPrefilter.getNBrows();++i) for (i=0;i<(int)_photoreceptorsPrefilter.getNBrows();++i)
{ {
for (j=0;j<(int)_photoreceptorsPrefilter.getNBcolumns();++j) for (j=0;j<(int)_photoreceptorsPrefilter.getNBcolumns();++j)
@ -209,12 +209,12 @@ namespace cv
float distanceToCenter=sqrt(((float)(i-halfRows)*(i-halfRows)+(j-halfColumns)*(j-halfColumns))); float distanceToCenter=sqrt(((float)(i-halfRows)*(i-halfRows)+(j-halfColumns)*(j-halfColumns)));
if (distanceToCenter<minDistance) if (distanceToCenter<minDistance)
{ {
float a=*(hybridParvoMagnoCoefTablePTR++)=0.5+0.5*cos(CV_PI*distanceToCenter/minDistance); float a=*(hybridParvoMagnoCoefTablePTR++)=0.5f+0.5f*(float)cos(CV_PI*distanceToCenter/minDistance);
*(hybridParvoMagnoCoefTablePTR++)=1.0-a; *(hybridParvoMagnoCoefTablePTR++)=1-a;
}else }else
{ {
*(hybridParvoMagnoCoefTablePTR++)=0; *(hybridParvoMagnoCoefTablePTR++)=0;
*(hybridParvoMagnoCoefTablePTR++)=1.0; *(hybridParvoMagnoCoefTablePTR++)=1.f;
} }
} }
} }
@ -226,15 +226,15 @@ namespace cv
_normalizeParvoOutput_0_maxOutputValue=normalizeParvoOutput_0_maxOutputValue; _normalizeParvoOutput_0_maxOutputValue=normalizeParvoOutput_0_maxOutputValue;
_normalizeMagnoOutput_0_maxOutputValue=normalizeMagnoOutput_0_maxOutputValue; _normalizeMagnoOutput_0_maxOutputValue=normalizeMagnoOutput_0_maxOutputValue;
_maxOutputValue=maxOutputValue; _maxOutputValue=maxOutputValue;
_photoreceptorsPrefilter.setV0CompressionParameter(0.9, maxInputValue, meanValue); _photoreceptorsPrefilter.setV0CompressionParameter(0.9f, maxInputValue, meanValue);
_photoreceptorsPrefilter.setLPfilterParameters(10, 0, 1.5, 1); // keeps low pass filter with high cut frequency in memory (usefull for the tone mapping function) _photoreceptorsPrefilter.setLPfilterParameters(10, 0, 1.5, 1); // keeps low pass filter with high cut frequency in memory (usefull for the tone mapping function)
_photoreceptorsPrefilter.setLPfilterParameters(10, 0, 3.0, 2); // keeps low pass filter with low cut frequency in memory (usefull for the tone mapping function) _photoreceptorsPrefilter.setLPfilterParameters(10, 0, 3.0, 2); // keeps low pass filter with low cut frequency in memory (usefull for the tone mapping function)
_photoreceptorsPrefilter.setLPfilterParameters(0, 0, 10, 3); // keeps low pass filter with low cut frequency in memory (usefull for the tone mapping function) _photoreceptorsPrefilter.setLPfilterParameters(0, 0, 10, 3); // keeps low pass filter with low cut frequency in memory (usefull for the tone mapping function)
//this->setV0CompressionParameter(0.6, maxInputValue, meanValue); // keeps log compression sensitivity parameter (usefull for the tone mapping function) //this->setV0CompressionParameter(0.6, maxInputValue, meanValue); // keeps log compression sensitivity parameter (usefull for the tone mapping function)
_ParvoRetinaFilter.setOPLandParvoFiltersParameters(0,OPLtemporalresponse1, OPLspatialResponse1, OPLassymetryGain, OPLtemporalresponse2, OPLspatialResponse2); _ParvoRetinaFilter.setOPLandParvoFiltersParameters(0,OPLtemporalresponse1, OPLspatialResponse1, OPLassymetryGain, OPLtemporalresponse2, OPLspatialResponse2);
_ParvoRetinaFilter.setV0CompressionParameter(0.9, maxInputValue, meanValue); _ParvoRetinaFilter.setV0CompressionParameter(0.9f, maxInputValue, meanValue);
_MagnoRetinaFilter.setCoefficientsTable(LPfilterGain, LPfilterTemporalresponse, LPfilterSpatialResponse, MovingContoursExtractorCoefficient, 0, 2.0*LPfilterSpatialResponse); _MagnoRetinaFilter.setCoefficientsTable(LPfilterGain, LPfilterTemporalresponse, LPfilterSpatialResponse, MovingContoursExtractorCoefficient, 0, 2*LPfilterSpatialResponse);
_MagnoRetinaFilter.setV0CompressionParameter(0.7, maxInputValue, meanValue); _MagnoRetinaFilter.setV0CompressionParameter(0.7f, maxInputValue, meanValue);
// stability controls value init // stability controls value init
_setInitPeriodCount(); _setInitPeriodCount();

View File

@ -221,7 +221,7 @@ public:
* setup the local luminance adaptation capability * setup the local luminance adaptation capability
* @param V0CompressionParameter: the compression strengh of the photoreceptors local adaptation output, set a value between 160 and 250 for best results, a high value increases more the low value sensitivity... and the output saturates faster, recommended value: 160 * @param V0CompressionParameter: the compression strengh of the photoreceptors local adaptation output, set a value between 160 and 250 for best results, a high value increases more the low value sensitivity... and the output saturates faster, recommended value: 160
*/ */
inline void setPhotoreceptorsLocalAdaptationSensitivity(const float V0CompressionParameter){_photoreceptorsPrefilter.setV0CompressionParameter(1.0-V0CompressionParameter);_setInitPeriodCount();}; inline void setPhotoreceptorsLocalAdaptationSensitivity(const float V0CompressionParameter){_photoreceptorsPrefilter.setV0CompressionParameter(1-V0CompressionParameter);_setInitPeriodCount();};
/** /**
* setup the local luminance adaptation capability * setup the local luminance adaptation capability
@ -457,7 +457,12 @@ public:
* @param projectedRadiusLength: the distance to image center in the retina log sampled space * @param projectedRadiusLength: the distance to image center in the retina log sampled space
* @return the distance to image center in the input image space * @return the distance to image center in the input image space
*/ */
inline const float getRetinaSamplingBackProjection(const float projectedRadiusLength){if (_photoreceptorsLogSampling)return _photoreceptorsLogSampling->getOriginalRadiusLength(projectedRadiusLength);else return projectedRadiusLength;}; inline const float getRetinaSamplingBackProjection(const float projectedRadiusLength)
{
if (_photoreceptorsLogSampling)
return (float)_photoreceptorsLogSampling->getOriginalRadiusLength(projectedRadiusLength);
return projectedRadiusLength;
};
/////////////////: /////////////////:
// retina dimensions getters // retina dimensions getters

View File

@ -405,7 +405,7 @@ void TemplateBuffer<type>::normalizeGrayOutput_0_maxOutputValue(type *inputOutpu
// change the range of the data to 0->255 // change the range of the data to 0->255
type factor = maxOutputValue/(maxValue-minValue); type factor = maxOutputValue/(maxValue-minValue);
type offset = -1.0*minValue*factor; type offset = (type)(-minValue*factor);
inputOutputBufferPTR=inputOutputBuffer; inputOutputBufferPTR=inputOutputBuffer;
for (register size_t j = 0; j < processedPixels; ++j, ++inputOutputBufferPTR) for (register size_t j = 0; j < processedPixels; ++j, ++inputOutputBufferPTR)

View File

@ -73,8 +73,12 @@
#endif #endif
#elif defined WIN32 || defined _WIN32 #elif defined WIN32 || defined _WIN32
#include <intrin.h> #define WIN32_MEAN_AND_LEAN
#define CV_XADD(addr,delta) _InterlockedExchangeAdd((long volatile*)(addr), (delta)) #include <windows.h>
#undef min
#undef max
#undef abs
#define CV_XADD(addr,delta) InterlockedExchangeAdd((long volatile*)(addr), (delta))
#else #else
template<typename _Tp> static inline _Tp CV_XADD(_Tp* addr, _Tp delta) template<typename _Tp> static inline _Tp CV_XADD(_Tp* addr, _Tp delta)

View File

@ -95,7 +95,7 @@ struct LshStats
*/ */
inline std::ostream& operator <<(std::ostream& out, const LshStats& stats) inline std::ostream& operator <<(std::ostream& out, const LshStats& stats)
{ {
size_t w = 20; int w = 20;
out << "Lsh Table Stats:\n" << std::setw(w) << std::setiosflags(std::ios::right) << "N buckets : " out << "Lsh Table Stats:\n" << std::setw(w) << std::setiosflags(std::ios::right) << "N buckets : "
<< stats.n_buckets_ << "\n" << std::setw(w) << std::setiosflags(std::ios::right) << "mean size : " << stats.n_buckets_ << "\n" << std::setw(w) << std::setiosflags(std::ios::right) << "mean size : "
<< std::setiosflags(std::ios::left) << stats.bucket_size_mean_ << "\n" << std::setw(w) << std::setiosflags(std::ios::left) << stats.bucket_size_mean_ << "\n" << std::setw(w)
@ -257,7 +257,7 @@ private:
void initialize(size_t key_size) void initialize(size_t key_size)
{ {
speed_level_ = kHash; speed_level_ = kHash;
key_size_ = key_size; key_size_ = (unsigned)key_size;
} }
/** Optimize the table for speed/space /** Optimize the table for speed/space

View File

@ -673,7 +673,7 @@ PERF_TEST_P(DevInfo_Size_MatType, countNonZero, testing::Combine(testing::Values
declare.in(src_host, WARMUP_RNG); declare.in(src_host, WARMUP_RNG);
GpuMat src(src_host); GpuMat src(src_host);
int dst; int dst=0;
GpuMat buf; GpuMat buf;
declare.time(0.5).iterations(100); declare.time(0.5).iterations(100);

View File

@ -122,7 +122,7 @@ void drawPlot(const cv::Mat curve, const std::string figureTitle, const int lowe
void callBack_rescaleGrayLevelMat(int, void*) void callBack_rescaleGrayLevelMat(int, void*)
{ {
std::cout<<"Histogram clipping value changed, current value = "<<histogramClippingValue<<std::endl; std::cout<<"Histogram clipping value changed, current value = "<<histogramClippingValue<<std::endl;
rescaleGrayLevelMat(inputImage, imageInputRescaled, (float)histogramClippingValue/100.0); rescaleGrayLevelMat(inputImage, imageInputRescaled, (float)(histogramClippingValue/100.0));
normalize(imageInputRescaled, imageInputRescaled, 0.0, 255.0, cv::NORM_MINMAX); normalize(imageInputRescaled, imageInputRescaled, 0.0, 255.0, cv::NORM_MINMAX);
} }
@ -132,13 +132,13 @@ void drawPlot(const cv::Mat curve, const std::string figureTitle, const int lowe
void callBack_updateRetinaParams(int, void*) void callBack_updateRetinaParams(int, void*)
{ {
retina->setupOPLandIPLParvoChannel(true, true, (double)localAdaptation_photoreceptors/200.0, 0.5, 0.43, (double)retinaHcellsGain, 1.0, 7.0, (double)localAdaptation_Gcells/200.0); retina->setupOPLandIPLParvoChannel(true, true, (float)(localAdaptation_photoreceptors/200.0), 0.5f, 0.43f, (double)retinaHcellsGain, 1.f, 7.f, (float)(localAdaptation_Gcells/200.0));
} }
int colorSaturationFactor; int colorSaturationFactor;
void callback_saturateColors(int, void*) void callback_saturateColors(int, void*)
{ {
retina->setColorSaturation((double)colorSaturationFactor/10.0); retina->setColorSaturation(true, colorSaturationFactor/10.0f);
} }
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
@ -244,7 +244,7 @@ void drawPlot(const cv::Mat curve, const std::string figureTitle, const int lowe
///////////////////////////////////////////// /////////////////////////////////////////////
// apply default parameters of user interaction variables // apply default parameters of user interaction variables
rescaleGrayLevelMat(inputImage, imageInputRescaled, (float)histogramClippingValue/100); rescaleGrayLevelMat(inputImage, imageInputRescaled, (float)histogramClippingValue/100);
retina->setColorSaturation(true,colorSaturationFactor); retina->setColorSaturation(true,(float)colorSaturationFactor);
callBack_updateRetinaParams(1,NULL); // first call for default parameters setup callBack_updateRetinaParams(1,NULL); // first call for default parameters setup
// processing loop with stop condition // processing loop with stop condition