本文整理汇总了C++中saveConfig函数的典型用法代码示例。如果您正苦于以下问题:C++ saveConfig函数的具体用法?C++ saveConfig怎么用?C++ saveConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了saveConfig函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ram
//.........这里部分代码省略.........
numentries++;
};
visible_lines = ((RESY/getFontHeight())-1)/2;
while (1) {
// Display current menu page
lcdClear();
lcdPrint("Config");
lcdSetCrsrX(60);
lcdPrint("[");
lcdPrint(IntToStr((current_offset/visible_lines)+1,1,0));
lcdPrint("/");
lcdPrint(IntToStr(((numentries-1)/visible_lines)+1,1,0));
lcdPrint("]");
lcdNl();
lcdNl();
uint8_t j=0;
for (uint8_t i=0;i<current_offset;i++)
while (the_config[++j].disabled);
uint8_t t=0;
for (uint8_t i=0;i<menuselection;i++)
while (the_config[++t].disabled);
for (uint8_t i = current_offset; i < (visible_lines + current_offset) && i < numentries; i++,j++) {
while(the_config[j].disabled)j++;
if(i==0){
lcdPrintln("Save changes:");
if (i == t)
lcdPrint("*");
lcdSetCrsrX(14);
if (i == t)
lcdPrintln("YES");
else
lcdPrintln("no");
}else{
lcdPrintln(the_config[j].name);
if (j == t)
lcdPrint("*");
lcdSetCrsrX(14);
lcdPrint("<");
lcdPrint(IntToStr(the_config[j].value,3,F_LONG));
lcdPrintln(">");
};
lcdRefresh();
}
switch (getInputWaitRepeat()) {
case BTN_UP:
menuselection--;
if (menuselection < current_offset) {
if (menuselection < 0) {
menuselection = numentries-1;
current_offset = ((numentries-1)/visible_lines) * visible_lines;
} else {
current_offset -= visible_lines;
}
}
break;
case BTN_DOWN:
menuselection++;
if (menuselection > (current_offset + visible_lines-1) || menuselection >= numentries) {
if (menuselection >= numentries) {
menuselection = 0;
current_offset = 0;
} else {
current_offset += visible_lines;
}
}
break;
case BTN_LEFT:
if(the_config[t].value >
the_config[t].min)
the_config[t].value--;
if(the_config[t].value > the_config[t].max)
the_config[t].value=
the_config[t].max;
applyConfig();
break;
case BTN_RIGHT:
if(the_config[t].value <
the_config[t].max)
the_config[t].value++;
if(the_config[t].value < the_config[t].min)
the_config[t].value=
the_config[t].min;
applyConfig();
break;
case BTN_ENTER:
if(menuselection==0)
saveConfig();
return;
}
}
/* NOTREACHED */
}
开发者ID:Bediko,项目名称:r0ket,代码行数:101,代码来源:config.c
示例2: saveConfig
PluginLoader::~PluginLoader() {
saveConfig();
unloadPlugins();
}
开发者ID:FalseCAM,项目名称:EasyImageSizer3,代码行数:4,代码来源:pluginloader.cpp
示例3: saveConfig
void CalibrationMain::on_SaveConfigButton_clicked()
{
saveConfig(currentFile);
}
开发者ID:MikeSantiagoInc,项目名称:PlatGEnWohl,代码行数:4,代码来源:calibrationmain.cpp
示例4: loadConfig
//.........这里部分代码省略.........
//frame_duration = 1.0 / 25.0;
frame_duration = 1.0f / 10.0f;
}
BGS->SetFrameRate(frame_duration);
if (status == MLBGS_LEARN)
{
if (loadDefaultParams)
{
mode_learn_rate_per_second = 0.5;
weight_learn_rate_per_second = 0.5;
init_mode_weight = 0.05f;
}
else
{
mode_learn_rate_per_second = learn_mode_learn_rate_per_second;
weight_learn_rate_per_second = learn_weight_learn_rate_per_second;
init_mode_weight = learn_init_mode_weight;
}
}
if (status == MLBGS_DETECT)
{
if (loadDefaultParams)
{
mode_learn_rate_per_second = 0.01f;
weight_learn_rate_per_second = 0.01f;
init_mode_weight = 0.001f;
}
else
{
mode_learn_rate_per_second = detect_mode_learn_rate_per_second;
weight_learn_rate_per_second = detect_weight_learn_rate_per_second;
init_mode_weight = detect_init_mode_weight;
}
}
BGS->SetParameters(max_mode_num, mode_learn_rate_per_second, weight_learn_rate_per_second, init_mode_weight);
saveConfig();
delete org_img;
}
//IplImage* inputImage = new IplImage(img_input);
//IplImage* img = cvCreateImage(img_size, IPL_DEPTH_8U, 3);
//cvCopy(inputImage, img);
//delete inputImage;
if (detectAfter > 0 && detectAfter == frameNumber)
{
std::cout << "MultiLayerBGS in DETECT mode" << std::endl;
status = MLBGS_DETECT;
mode_learn_rate_per_second = 0.01f;
weight_learn_rate_per_second = 0.01f;
init_mode_weight = 0.001f;
BGS->SetParameters(max_mode_num, mode_learn_rate_per_second, weight_learn_rate_per_second, init_mode_weight);
BGS->m_disableLearning = disableLearning;
if (disableLearning)
std::cout << "MultiLayerBGS disabled learning in DETECT mode" << std::endl;
else
std::cout << "MultiLayerBGS enabled learning in DETECT mode" << std::endl;
}
IplImage* img = new IplImage(img_input);
BGS->SetRGBInputImage(img);
BGS->Process();
BGS->GetBackgroundImage(bg_img);
BGS->GetForegroundImage(fg_img);
BGS->GetForegroundProbabilityImage(fg_prob_img3);
BGS->GetForegroundMaskImage(fg_mask_img);
BGS->MergeImages(4, img, bg_img, fg_prob_img3, fg_img, merged_img);
img_merged = cv::Mat(merged_img);
img_foreground = cv::Mat(fg_mask_img);
img_background = cv::Mat(bg_img);
if (showOutput)
{
//cv::imshow("MLBGS Layers", img_merged);
// cv::imshow("MLBGS FG Mask", img_foreground);
}
img_foreground.copyTo(img_output);
img_background.copyTo(img_bgmodel);
delete img;
//cvReleaseImage(&img);
firstTime = false;
frameNumber++;
}
开发者ID:doankhoi,项目名称:LTT.EST.CameraMarketing,代码行数:101,代码来源:MultiLayerBGS.cpp
示例5: getConfigFileName
void Config::save() const
{
char filename[MAX_STRING_SIZE];
getConfigFileName(filename, MAX_STRING_SIZE);
saveConfig(filename);
}
开发者ID:ViktorNova,项目名称:Carla,代码行数:6,代码来源:Config.cpp
示例6: saveConfig
bool MICCD::SetFilterNames()
{
// Cannot save it in hardware, so let's just save it in the config file to be loaded later
saveConfig();
return true;
}
开发者ID:garlick,项目名称:indi,代码行数:6,代码来源:mi_ccd.cpp
示例7: loadConfig
void T2FMRF_UM::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &img_bgmodel)
{
if(img_input.empty())
return;
loadConfig();
if(firstTime)
saveConfig();
frame = new IplImage(img_input);
if(firstTime)
frame_data.ReleaseMemory(false);
frame_data = frame;
if(firstTime)
{
int width = img_input.size().width;
int height = img_input.size().height;
lowThresholdMask = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
lowThresholdMask.Ptr()->origin = IPL_ORIGIN_BL;
highThresholdMask = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
highThresholdMask.Ptr()->origin = IPL_ORIGIN_BL;
params.SetFrameSize(width, height);
params.LowThreshold() = threshold;
params.HighThreshold() = 2*params.LowThreshold();
params.Alpha() = alpha;
params.MaxModes() = gaussians;
params.Type() = TYPE_T2FMRF_UM;
params.KM() = km; // Factor control for the T2FMRF-UM [0,3] default: 2
params.KV() = kv; // Factor control for the T2FMRF-UV [0.3,1] default: 0.9
bgs.Initalize(params);
bgs.InitModel(frame_data);
old_labeling = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
old = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
mrf.height = height;
mrf.width = width;
mrf.Build_Classes_OldLabeling_InImage_LocalEnergy();
firstTime = false;
}
bgs.Subtract(frameNumber, frame_data, lowThresholdMask, highThresholdMask);
cvCopy(lowThresholdMask.Ptr(), old);
/************************************************************************/
/* the code for MRF, it can be noted when using other methods */
/************************************************************************/
//the optimization process is done when the foreground detection is stable,
if(frameNumber >= 10)
{
gmm = bgs.gmm();
hmm = bgs.hmm();
mrf.background2 = frame_data.Ptr();
mrf.in_image = lowThresholdMask.Ptr();
mrf.out_image = lowThresholdMask.Ptr();
mrf.InitEvidence2(gmm,hmm,old_labeling);
mrf.ICM2();
cvCopy(mrf.out_image, lowThresholdMask.Ptr());
}
cvCopy(old, old_labeling);
lowThresholdMask.Clear();
bgs.Update(frameNumber, frame_data, lowThresholdMask);
cv::Mat foreground(highThresholdMask.Ptr());
if(showOutput)
cv::imshow("T2FMRF-UM", foreground);
foreground.copyTo(img_output);
delete frame;
frameNumber++;
}
开发者ID:2php,项目名称:ShadowDetection,代码行数:83,代码来源:T2FMRF_UM.cpp
示例8: loadConfig
//.........这里部分代码省略.........
cv::circle(img_input, cv::Point((*it3).x,(*it3).y), 3, cv::Scalar(255,255,255), -1);
}
points.erase(it2);
points.insert(std::pair<cvb::CvID, std::vector<CvPoint2D64f>>(id,centroids2));
}
else
{
points.erase(it2);
}
}
else
{
if(track->inactive == 0)
{
std::vector<CvPoint2D64f> centroids;
centroids.push_back(centroid);
// time(&start);
points.insert(std::pair<cvb::CvID, std::vector<CvPoint2D64f>>(id,centroids));
}
//
std::map<cvb::CvID, CarSpeed>::iterator speedit =carspeeds.find(id);
CarSpeed carspeed2 =speedit->second;
time(&end);
carspeed2.lasttime = end;
carspeed2.lastcentroid = centroid;
carspeeds.insert(std::pair<cvb::CvID, CarSpeed>(id,carspeed2));
// std::cout << "latest center point...id:" << id <<" cost time: "<<difftime(carspeed2.lasttime,carspeed2.starttime) << " (" << carspeed2.startcentroid.x << "," << carspeed2.startcentroid.y << ")" << " (" << carspeed2.lastcentroid.x << "," << carspeed2.lastcentroid.y << ")" << std::endl;
//
if(difftime(carspeed2.lasttime,carspeed2.starttime)>0){
double costtime =difftime(carspeed2.lasttime,carspeed2.starttime);
double distance =sqrt((carspeed2.startcentroid.y - carspeed2.lastcentroid.y) *(carspeed2.startcentroid.y - carspeed2.lastcentroid.y)+(carspeed2.startcentroid.x - carspeed2.lastcentroid.x)*(carspeed2.startcentroid.x - carspeed2.lastcentroid.x));
// std::cout<<"ID:"<<id<<" Distance: "<<distance<<" Time: "<<costtime<<" speed: "<<distance/costtime<<std::endl;
IdSpeed is;
is.id=id;
is.speed=distance/costtime;
idspeeds.push_back(is);
}
}
// time(&end);
// double sec=difftime(end,start);
endpoint = centroid;
// double distance =sqrt((endpoint.y-startpoint.y) *(endpoint.y-startpoint.y)+(endpoint.x-startpoint.x)*(endpoint.x-startpoint.x));
// std::cout <<"track->id:"<<track->id << " track->lifetime: " << track->lifetime ;
// printf("distance : %f ",distance);
// printf("time cost: %lf \n ",sec);
//cv::waitKey(0);
}
//--------------------------------------------------------------------------
// std::cout<<"endtime"<<std::endl;
time(&endtime);
//if 30 second has passed ,please recount the car num.
if(difftime(endtime,origintime)>30){
std::cout<<"30 seconds has passed"<<std::endl;
countAB=0;
countBA=0;
std::cout<<"restarttime"<<std::endl;
time(&origintime);
}
if(showAB == 0)
{
cv::putText(img_input, "A->B: " + boost::lexical_cast<std::string>(countAB), cv::Point(10,img_h-20), cv::FONT_HERSHEY_PLAIN, 1, cv::Scalar(255,255,255));
cv::putText(img_input, "B->A: " + boost::lexical_cast<std::string>(countBA), cv::Point(10,img_h-8), cv::FONT_HERSHEY_PLAIN, 1, cv::Scalar(255,255,255));
}
if(showAB == 1){
cv::putText(img_input, "A->B: " + boost::lexical_cast<std::string>(countAB), cv::Point(10,img_h-8), cv::FONT_HERSHEY_PLAIN, 1, cv::Scalar(255,255,255));
}
if(showAB == 2)
{
cv::putText(img_input, "B->A: " + boost::lexical_cast<std::string>(countBA), cv::Point(10,img_h-8), cv::FONT_HERSHEY_PLAIN, 1, cv::Scalar(255,255,255));
}
if(showOutput)
cv::imshow("VehicleCouting", img_input);
if(firstTime)
saveConfig();
firstTime = false;
}
开发者ID:uwitec,项目名称:Intelligent-Monitoring-System,代码行数:101,代码来源:VehicleCouting.cpp
示例9: saveConfig
PRL_RESULT CDspDispConfigGuard::saveConfig( bool bNoSaveNetwork )
{
QString path = ParallelsDirs::getDispatcherConfigFilePath();
return saveConfig( path, bNoSaveNetwork );
}
开发者ID:Lantame,项目名称:prl-disp-service,代码行数:5,代码来源:CDspDispConfigGuard.cpp
示例10: saveConfig
ApokalypseApp::~ApokalypseApp(){
if (screen) delete screen;
if (!configfile.isEmpty())
saveConfig();
}
开发者ID:BackupTheBerlios,项目名称:apokalypse,代码行数:5,代码来源:apokalypseapp.cpp
示例11: realmain
//.........这里部分代码省略.........
// FIXME: Change this to LOG_WZ on next release
debug(LOG_INFO, "Using %s debug file", buf);
}
// NOTE: it is now safe to use debug() calls to make sure output gets captured.
check_Physfs();
debug(LOG_WZ, "Warzone 2100 - %s", version_getFormattedVersionString());
debug(LOG_WZ, "Using language: %s", getLanguage());
debug(LOG_WZ, "Backend: %s", BACKEND);
debug(LOG_MEMORY, "sizeof: SIMPLE_OBJECT=%ld, BASE_OBJECT=%ld, DROID=%ld, STRUCTURE=%ld, FEATURE=%ld, PROJECTILE=%ld",
(long)sizeof(SIMPLE_OBJECT), (long)sizeof(BASE_OBJECT), (long)sizeof(DROID), (long)sizeof(STRUCTURE), (long)sizeof(FEATURE), (long)sizeof(PROJECTILE));
/* Put in the writedir root */
sstrcpy(KeyMapPath, "keymap.map");
// initialise all the command line states
war_SetDefaultStates();
debug(LOG_MAIN, "initializing");
PhysicsEngineHandler engine; // register abstract physfs filesystem
loadConfig();
// parse the command line
if (!ParseCommandLine(utfargc, utfargv))
{
return EXIT_FAILURE;
}
// Save new (commandline) settings
saveConfig();
// Find out where to find the data
scanDataDirs();
// Now we check the mods to see if they exist or not (specified on the command line)
// They are all capped at 100 mods max(see clparse.c)
// FIX ME: I know this is a bit hackish, but better than nothing for now?
{
char *modname;
char modtocheck[256];
int i = 0;
int result = 0;
// check global mods
for(i=0; i < 100; i++)
{
modname = global_mods[i];
if (modname == NULL)
{
break;
}
ssprintf(modtocheck, "mods/global/%s", modname);
result = PHYSFS_exists(modtocheck);
result |= PHYSFS_isDirectory(modtocheck);
if (!result)
{
debug(LOG_ERROR, "The (global) mod (%s) you have specified doesn't exist!", modname);
}
else
{
info("(global) mod (%s) is enabled", modname);
}
开发者ID:omgbebebe,项目名称:warzone2100,代码行数:67,代码来源:main.cpp
示例12: saveConfig
KChatBaseModel::~KChatBaseModel()
{
// kDebug(11000) << "KChatBaseModelPrivate: DESTRUCT (" << this << ")";
saveConfig();
}
开发者ID:jsj2008,项目名称:kdegames,代码行数:5,代码来源:kchatbasemodel.cpp
示例13: IUUpdateNumber
bool QHYCCD::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
{
// first check if it's for our device
//IDLog("INDI::CCD::ISNewNumber %s\n",name);
if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
{
if (strcmp(name, FilterSlotNP.name) == 0)
{
INDI::FilterInterface::processNumber(dev, name, values, names, n);
return true;
}
if (strcmp(name, GainNP.name) == 0)
{
IUUpdateNumber(&GainNP, values, names, n);
GainRequest = GainN[0].value;
if (LastGainRequest != GainRequest)
{
SetQHYCCDParam(camhandle, CONTROL_GAIN, GainN[0].value);
LastGainRequest = GainRequest;
}
DEBUGF(INDI::Logger::DBG_SESSION, "Current %s value %f", GainNP.name, GainN[0].value);
GainNP.s = IPS_OK;
IDSetNumber(&GainNP, NULL);
return true;
}
if (strcmp(name, OffsetNP.name) == 0)
{
IUUpdateNumber(&OffsetNP, values, names, n);
SetQHYCCDParam(camhandle, CONTROL_OFFSET, OffsetN[0].value);
DEBUGF(INDI::Logger::DBG_SESSION, "Current %s value %f", OffsetNP.name, OffsetN[0].value);
OffsetNP.s = IPS_OK;
IDSetNumber(&OffsetNP, NULL);
saveConfig(true, OffsetNP.name);
return true;
}
if (strcmp(name, SpeedNP.name) == 0)
{
IUUpdateNumber(&SpeedNP, values, names, n);
SetQHYCCDParam(camhandle, CONTROL_SPEED, SpeedN[0].value);
DEBUGF(INDI::Logger::DBG_SESSION, "Current %s value %f", SpeedNP.name, SpeedN[0].value);
SpeedNP.s = IPS_OK;
IDSetNumber(&SpeedNP, NULL);
saveConfig(true, SpeedNP.name);
return true;
}
if (strcmp(name, USBTrafficNP.name) == 0)
{
IUUpdateNumber(&USBTrafficNP, values, names, n);
SetQHYCCDParam(camhandle, CONTROL_USBTRAFFIC, USBTrafficN[0].value);
DEBUGF(INDI::Logger::DBG_SESSION, "Current %s value %f", USBTrafficNP.name, USBTrafficN[0].value);
USBTrafficNP.s = IPS_OK;
IDSetNumber(&USBTrafficNP, NULL);
saveConfig(true, USBTrafficNP.name);
return true;
}
}
// if we didn't process it, continue up the chain, let somebody else
// give it a shot
return INDI::CCD::ISNewNumber(dev, name, values, names, n);
}
开发者ID:rrogge,项目名称:indi,代码行数:64,代码来源:qhy_ccd.cpp
示例14: qDebug
/*! \brief Load new configuration.
* \param cfgfile
* \returns True if config is OK, False if not (e.g. no input device specified).
*
* If cfgfile is an absolute path it will be used as is, otherwise it is assumed to be the
* name of a file under m_cfg_dir.
*
* If cfgfile does not exist it will be created.
*
* If no input device is specified, we return false to signal that the I/O configuration
* dialog should be run.
*
* FIXME: Refactor.
*/
bool MainWindow::loadConfig(const QString cfgfile, bool check_crash)
{
bool conf_ok = false;
bool skipLoadingSettings = false;
qDebug() << "Loading configuration from:" << cfgfile;
if (m_settings)
delete m_settings;
if (QDir::isAbsolutePath(cfgfile))
m_settings = new QSettings(cfgfile, QSettings::IniFormat);
else
m_settings = new QSettings(QString("%1/%2").arg(m_cfg_dir).arg(cfgfile), QSettings::IniFormat);
qDebug() << "Configuration file:" << m_settings->fileName();
if (check_crash)
{
if (m_settings->value("crashed", false).toBool())
{
qDebug() << "Crash guard triggered!" << endl;
QMessageBox* askUserAboutConfig =
new QMessageBox(QMessageBox::Warning, tr("Crash Detected!"),
tr("<p>Gqrx has detected problems with the current configuration. "
"Loading the configuration again could cause the application to crash.</p>"
"<p>Do you want to edit the settings?</p>"),
QMessageBox::Yes | QMessageBox::No);
askUserAboutConfig->setDefaultButton(QMessageBox::Yes);
askUserAboutConfig->setTextFormat(Qt::RichText);
askUserAboutConfig->exec();
if (askUserAboutConfig->result() == QMessageBox::Yes)
skipLoadingSettings = true;
delete askUserAboutConfig;
}
else
{
m_settings->setValue("crashed", true); // clean exit will set this to FALSE
saveConfig(cfgfile);
}
}
if (skipLoadingSettings)
return false;
emit configChanged(m_settings);
// manual reconf (FIXME: check status)
bool conv_ok = false;
QString indev = m_settings->value("input/device", "").toString();
if (!indev.isEmpty())
{
conf_ok = true;
rx->set_input_device(indev.toStdString());
// Update window title
QRegExp regexp("'([a-zA-Z0-9 \\-\\_\\/\\.\\,\\(\\)]+)'");
QString devlabel;
if (regexp.indexIn(indev, 0) != -1)
devlabel = regexp.cap(1);
else
devlabel = indev; //"Unknown";
setWindowTitle(QString("Gqrx %1 - %2").arg(VERSION).arg(devlabel));
// Add available antenna connectors to the UI
std::vector<std::string> antennas = rx->get_antennas();
uiDockInputCtl->setAntennas(antennas);
}
QString outdev = m_settings->value("output/device", "").toString();
rx->set_output_device(outdev.toStdString());
int sr = m_settings->value("input/sample_rate", 0).toInt(&conv_ok);
if (conv_ok && (sr > 0))
{
double actual_rate = rx->set_input_rate(sr);
qDebug() << "Requested sample rate:" << sr;
qDebug() << "Actual sample rate :" << QString("%1").arg(actual_rate, 0, 'f', 6);
uiDockRxOpt->setFilterOffsetRange((qint64)(0.9*actual_rate));
ui->plotter->setSampleRate(actual_rate);
ui->plotter->setSpanFreq((quint32)actual_rate);
}
//.........这里部分代码省略.........
开发者ID:scottdm,项目名称:gqrx,代码行数:101,代码来源:mainwindow.cpp
示例15: saveConfig
bool CConfigFile::saveConfig(const std::string & filename)
{
return saveConfig(filename.c_str());
}
开发者ID:FFTEAM,项目名称:evolux-spark-sh4,代码行数:4,代码来源:configfile.cpp
示例16: img_input_f3
void FuzzySugenoIntegral::process(const cv::Mat &img_input, cv::Mat &img_output)
{
if(img_input.empty())
return;
cv::Mat img_input_f3(img_input.size(), CV_32F);
img_input.convertTo(img_input_f3, CV_32F, 1./255.);
loadConfig();
if(firstTime)
{
std::cout << "FuzzySugenoIntegral parameters:" << std::endl;
std::string colorSpaceName = "";
switch(colorSpace)
{
case 1: colorSpaceName = "RGB"; break;
case 2: colorSpaceName = "OHTA"; break;
case 3: colorSpaceName = "HSV"; break;
case 4: colorSpaceName = "YCrCb"; break;
}
std::cout << "Color space: " << colorSpaceName << std::endl;
if(option == 1)
std::cout << "Fuzzing by 3 color components" << std::endl;
if(option == 2)
std::cout << "Fuzzing by 2 color components + 1 texture component" << std::endl;
saveConfig();
}
if(frameNumber <= framesToLearn)
{
if(frameNumber == 0)
std::cout << "FuzzySugenoIntegral initializing background model by adaptive learning..." << std::endl;
if(img_background_f3.empty())
img_input_f3.copyTo(img_background_f3);
else
img_background_f3 = alphaLearn*img_input_f3 + (1-alphaLearn)*img_background_f3;
if(showOutput)
cv::imshow("SI BG Model", img_background_f3);
}
else
{
cv::Mat img_input_f1;
cv::cvtColor(img_input_f3, img_input_f1, CV_BGR2GRAY);
cv::Mat img_background_f1;
cv::cvtColor(img_background_f3, img_background_f1, CV_BGR2GRAY);
IplImage* input_f3 = new IplImage(img_input_f3);
IplImage* input_f1 = new IplImage(img_input_f1);
IplImage* background_f3 = new IplImage(img_background_f3);
IplImage* background_f1 = new IplImage(img_background_f1);
IplImage* lbp_input_f1 = cvCreateImage(cvSize(input_f1->width, input_f1->height), IPL_DEPTH_32F, 1);
cvFillImage(lbp_input_f1, 0.0);
fu.LBP(input_f1, lbp_input_f1);
IplImage* lbp_background_f1 = cvCreateImage(cvSize(background_f1->width, background_f1->height), IPL_DEPTH_32F , 1);
cvFillImage(lbp_background_f1, 0.0);
fu.LBP(background_f1, lbp_background_f1);
IplImage* sim_texture_f1 = cvCreateImage(cvSize(input_f1->width, input_f1->height), IPL_DEPTH_32F, 1);
fu.SimilarityDegreesImage(lbp_input_f1, lbp_background_f1, sim_texture_f1, 1, colorSpace);
IplImage* sim_color_f3 = cvCreateImage(cvSize(input_f3->width, input_f3->height), IPL_DEPTH_32F, 3);
fu.SimilarityDegreesImage(input_f3, background_f3, sim_color_f3, 3, colorSpace);
float* measureG = (float*) malloc(3*(sizeof(float)));
IplImage* integral_sugeno_f1 = cvCreateImage(cvSize(input_f1->width, input_f1->height), IPL_DEPTH_32F, 1);
// 3 color components
if(option == 1)
{
fu.FuzzyMeasureG(0.4, 0.3, 0.3, measureG);
fu.getFuzzyIntegralSugeno(sim_texture_f1, sim_color_f3, option, measureG, integral_sugeno_f1);
}
// 2 color components + 1 texture component
if(option == 2)
{
fu.FuzzyMeasureG(0.6, 0.3, 0.1, measureG);
fu.getFuzzyIntegralSugeno(sim_texture_f1, sim_color_f3, option, measureG, integral_sugeno_f1);
}
free(measureG);
cv::Mat img_integral_sugeno_f1(integral_sugeno_f1);
if(smooth)
cv::medianBlur(img_integral_sugeno_f1, img_integral_sugeno_f1, 3);
cv::Mat img_foreground_f1(img_input.size(), CV_32F);
cv::threshold(img_integral_sugeno_f1, img_foreground_f1, threshold, 255, cv::THRESH_BINARY_INV);
cv::Mat img_foreground_u1(img_input.size(), CV_8U);
double minVal = 0., maxVal = 1.;
//.........这里部分代码省略.........
开发者ID:berlino,项目名称:traffic-counting,代码行数:101,代码来源:FuzzySugenoIntegral.cpp
示例17: readServerData
//.........这里部分代码省略.........
if (playerObjects->at(p) != NULL && playerObjects->at(p) == iter->second) {
playerObjects->at(p) = NULL;
}
}
gameObjects->remove(iter->first, iter->second);
delete (*gameObjects)[i];
gameObjects->erase(gameObjects->begin() + i);
i--;
}
}*/
/*for (int i = 0; i < (int)gameObjects->size(); i++) {
(*gameObjects)[i]->update(elapsedTime);
if (!(*gameObjects)[i]->isAlive()) {
serverEventsTCP->appendToSendBuffer(NetworkFunctions::createDeleteObjectBuffer(i));
for (int p = 0; p < maxPlayers; p++) {
if (playerObjects->at(p) != NULL && playerObjects->at(p) == (*gameObjects)[i]) {
playerObjects->at(p) = NULL;
}
}
delete (*gameObjects)[i];
gameObjects->erase(gameObjects->begin() + i);
i--;
}
}*/
//Update each client
//for (int i = 0; i < gameObjects->size(); i++)
// serverEvents->appendToSendBuffer(NetworkFunctions::createUpdateObjectBuffer(i));
for (int i = 0; i < maxPlayers; i++) {
aquireClientsMutex(i);
if (clients[i]->isConnected()) {
if (clients[i]->requiresSynch()) {
synchClient(i);
clients[i]->setSynch(false);
}
else {
clients[i]->pushSendData(serverEventsTCP->getSendBuffer(), serverEventsTCP->getSendBufferSize());
}
}
releaseClientsMutex(i);
}
for (int i = 0; i < maxPlayers; i++) {
aquireClientsMutex(i);
if (clients[i]->isConnected()) {
//unsigned long clientPortUDP = clients[i]->getPortUDP();
if (!clients[i]->requiresSynch()) {
serverEventsUDP->clearSendBuffer();
for (list<pair<unsigned long, GameObject*>>::iterator iter = gameObjects->begin(); iter != gameObjects->end(); iter++) {
if (playerObjects->at(i) != iter->second /* && dont force player */) {
DataBuffer * temp = NetworkFunctions::createUpdateObjectBuffer(iter->second->getNetID());
serverEventsUDP->appendToSendBuffer(temp);
}
}
UDPManager::sendDatagram(serverEventsUDP->getSendBuffer(), serverEventsUDP->getSendBufferSize(), clients[i]->getIPAddress(), clients[i]->getPortUDP(), frameCount);
}
}
releaseClientsMutex(i);
}
/*timeSinceLastRender += elapsedTime;
if (timeSinceLastRender >= timePerRenderFrame) {
timeSinceLastRender = 0.0;
renderFrame();
}*/
renderFrame();
//Update Rate Calculations
//Framerate Limit Calculations
elapsedTime = SDL_GetTicks() - lastTime;
targetSleep = timePerFrame - elapsedTime + sleepRemainder;
if (targetSleep > 0) sleepRemainder = targetSleep - (Uint32)targetSleep;
//Sleep(1000.0 / 64.0);
startSleep = SDL_GetTicks();
while ((Uint32)(startSleep + targetSleep) > SDL_GetTicks());
sleepTime = SDL_GetTicks() - startSleep;
}
cout << "Shutting Down\n";
HostThread::stopAll();
HostListener::stop();
UDPManager::cleanup();
WSACleanup();
WaitForSingleObject(listenThreadHandle, INFINITE);
saveConfig();
cleanupObjects();
//saveConfig();
killBullet();
//delete [] clients;
return 0;
}
开发者ID:BSkin,项目名称:Rune,代码行数:101,代码来源:Server.cpp
示例18: saveConfig
void SettingsDBManager::addSettings(const std::string& key, const std::string&value) {
config[key] = value;
//записать в файл сразу же!
saveConfig();
}
开发者ID:bagrusss,项目名称:cpp_project,代码行数:6,代码来源:dbmanager.cpp
示例19: saveConfig
ThumbView::~ThumbView()
{
saveConfig();
}
开发者ID:serghei,项目名称:kde3-kdegraphics,代码行数:4,代码来源:thumbview.cpp
示例20: statusBar
ShareConfigMainWindow::ShareConfigMainWindow()
{
configuration = Share::Configuration::getInstance();
// Create de main window.
ShareConfigWidget *mainWidget = new ShareConfigWidget;
QMainWindow::setCentralWidget(mainWidget);
statusBar()->showMessage(tr("Loading..."));
connect(mainWidget,SIGNAL(quitRequest()),this,SIGNAL(quitRequest()));
// connect mainWidget with configuration instance
// Tab<System>.system
connect(configuration,SIGNAL(changeSystem_SystemDeamon(bool)),mainWidget,SLOT(setSystemSystemDeamon(bool)));
connect(configuration,SIGNAL(changeSystem_SystemCommunicationMode(Share::Communication::Type)),mainWidget,SLOT(setSystemSystemCommunicationMode(Share::Communication::Type)));
connect(configuration,SIGNAL(changeSystem_SystemListenPort(int)),mainWidget,SLOT(setSystemSystemListenPort(int)));
connect(configuration,SIGNAL(changeSystem_SystemLocalListenPort(int)),mainWidget,SLOT(setSystemSystemLocalListenPort(int)));
connect(configuration,SIGNAL(changeSystem_SystemCachePath(QString)),mainWidget,SLOT(setSystemSystemCachePath(QString)));
connect(configuration,SIGNAL(changeSystem_SystemCacheQuota(int)),mainWidget,SLOT(setSystemSystemCacheQuota(int)));
// Tab<System>.User
connect(configuration,SIGNAL(changeSystem_UserDeamon(bool)),mainWidget,SLOT(setSystemUserDeamon(bool)));
connect(configuration,SIGNAL(changeSystem_UserCommViaSystemDeamon(bool)),mainWidget,SLOT(setSystemUserCommViaSystemDeamon(bool)));
connect(configuration,SIGNAL(changeSystem_UserListenPort(int)),mainWidget,SLOT(setSystemUserListenPort(int)));
connect(configuration,SIGNAL(changeSystem_UserCommunicationMode(Share::Communication::Type)),mainWidget,SLOT(setSystemUserCommunicationMode(Share::Communication::Type)));
connect(configuration,SIGNAL(changeSystem_UserLocalListenPort(int)),mainWidget,SLOT(setSystemUserLocalListenPort(int)));
connect(configuration,SIGNAL(changeSystem_UserCachePath(QString)),mainWidget,SLOT(setSystemUserCachePath(QString)));
connect(configuration,SIGNAL(changeSystem_UserCacheQuota(int)),mainWidget,SLOT(setSystemUserCacheQuota(int)));
// Tab<User>
connect(configuration,SIGNAL(changeUser_UseSystemSettings(bool)),mainWidget,SLOT(setUserUseSystemSettings(bool)));
connect(configuration,SIGNAL(changeUser_UserDeamon(bool)),mainWidget,SLOT(setUserUserDeamon(bool)));
connect(configuration,SIGNAL(changeUser_UserCommunicationMode(Share::Communication::Type)),mainWidget,SLOT(setUserUserCommunicationMode(Share::Communication::Type)));
connect(configuration,SIGNAL(changeUser_UserListenPort(int)),mainWidget,SLOT(setUserUserListenPort(int)));
connect(configuration,SIGNAL(changeUser_UserLocalListenPort(int)),mainWidget,SLOT(setUserUserLocalListenPort(int)));
connect(configuration,SIGNAL(changeUser_UserCachePath(QString)),mainWidget,SLOT(setUserUserCachePath(QString)));
connect(configuration,SIGNAL(changeUser_UserCacheQuota(int)),mainWidget,SLOT(setUserUserCacheQuota(int)));
// Inform configuration class
connect(mainWidget,SIGNAL(validateConfig()),this,SLOT(startSaving()));
connect(mainWidget,SIGNAL(validateConfig()),configuration,SLOT(saveConfig()));
// Connect events saving...
connect(configuration,SIGNAL(configLoaded(bool)),this,SLOT(configLoaded(bool)));
connect(configuration,SIGNAL(configLoaded(bool)),mainWidget,SLOT(configLoaded(bool)));
connect(configuration,SIGNAL(configSaved(bool)),this,SLOT(configSaved(bool)));
connect(configuration,SIGNAL(configSaved(bool)),mainWidget,SLOT(configSaved(bool)));
// Connect changes on interface to the configuration class
connect(mainWidget,SIGNAL(changeSystemSystemDeamon(bool)),configuration,SLOT(setSystem_SystemDeamon(bool)));
connect(mainWidget,SIGNAL(changeSystemSystemListenPort(int)),configuration,SLOT(setSystem_SystemListenPort(int)));
connect(mainWidget,SIGNAL(changeSystemSystemCommunicationMode(Share::Communication::Type)),configuration,SLOT(setSystem_SystemCommunicationMode(Share::Communication::Type)));
connect(mainWidget,SIGNAL(changeSystemSystemLocalListenPort(int)),configuration,SLOT(setSystem_SystemLocalListenPort(int)));
connect(mainWidget,SIGNAL(changeSystemSystemCachePath(QString)),configuration,SLOT(setSystem_SystemCachePath(QString)));
connect(mainWidget,SIGNAL(changeSystemSystemCacheQuota(int)),configuration,SLOT(setSystem_SystemCacheQuota(int)));
connect(mainWidget,SIGNAL(changeSystemUserDeamon(bool)),configuration,SLOT(setSystem_UserDeamon(bool)));
connect(mainWidget,SIGNAL(changeSystemUserCommViaSystemDeamon(bool)),configuration,SLOT(setSystem_UserCommViaSystemDeamon(bool)));
connect(mainWidget,SIGNAL(changeSystemUserListenPort(int)),configuration,SLOT(setSystem_UserListenPort(int)));
connect(mainWidget,SIGNAL(changeSystemUserCommunicationMode(Share::Communication::Type)),configuration,SLOT(setSystem_UserCommunicationMode(Share::Communication::Type)));
connect(mainWidget,SIGNAL(changeSystemUserLocalListenPort(int)),configuration,SLOT(setSystem_UserLocalListenPort(int)));
connect(mainWidget,SIGNAL(changeSystemUserCachePath(QString)),configuration,SLOT(setSystem_UserCachePath(QString)));
connect(mainWidget,SIGNAL(changeSystemUserCacheQuota(int)),configuration,SLOT(setSystem_UserCacheQuota(int)));
connect(mainWidget,SIGNAL(changeUserUseSystemSettings(bool)),configuration,SLOT(setUser_UseSystemSettings(bool)));
connect(mainWidget,SIGNAL(changeUserUserDeamon(bool)),configuration,SLOT(setUser_UserDeamon(bool)));
connect(mainWidget,SIGNAL(changeUserUserCommunicationMode(Share::Communication::Type)),configuration,SLOT(setUser_UserCommunicationMode(Share::Communication::Type)));
connect(mainWidget,SIGNAL(changeUserUserListenPort(int)),configuration,SLOT(setUser_UserListenPort(int)));
connect(mainWidget,SIGNAL(changeUserUserLocalListenPort(int)),configuration,SLOT(setUser_UserLocalListenPort(int)));
connect(mainWidget,SIGNAL(changeUserUserCachePath(QString)),configuration,SLOT(setUser_UserCachePath(QString)));
connect(mainWidget,SIGNAL(changeUserUserCacheQuota(int)),configuration,SLOT(setUser_UserCacheQuota(int)));
// Send configuration
configuration->loadConfig();
}
开发者ID:capello,项目名称:SharedResource,代码行数:73,代码来源:ShareConfigMainWindow.cpp
注:本文中的saveConfig函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论