Ejemplo n.º 1
0
void StegoModel::doMMDs() {
  map< pair< int, int >, FeatureCollection* >::iterator fiter;
  FeatureCollection::Iterator *citer;
//   featureSet *stego;
  
  mc = (mmdContext*) malloc(sizeof(mmdContext));
  mc->clean = cleanSet;
  startAction(mc->clean);
  initMMD(steg, *mc);
  estimateGamma(steg, *mc);
  
//   mc->stego = mc->clean;
//   estimateMMD(steg, *mc);
  
  for (fiter = collections.begin(); fiter != collections.end(); fiter++) {
    if (fiter->second != 0) {
      printf("<%i, %i> \n", fiter->first.first, fiter->first.second);
      citer = fiter->second->iterator();
      while (citer->hasNext()) {
	mc->stego = citer->next();
	printf("doing set %g \n", mc->stego->header->prob);
	startAction(mc->stego);
	estimateMMD(steg, *mc);
	mc->stego->mmd = mc->mmd;
	endAction(mc->stego);
      }
    }
  }
  endAction(mc->clean);
  closeMMD(*mc);
}
Ejemplo n.º 2
0
void StegoModel::estimateMus() {
  map< pair< int, int >, FeatureCollection* >::iterator fiter;
  FeatureCollection::Iterator *citer;
//   featureSet *stego;
  steg->features = cleanSet;
//   printf("activating something \n");
  startAction(steg->features);
//   printf("estimating some mu... \n");
  estimateMu(steg);
//   printf("done \n");
//   estimateSigma(steg);
//   qrHouseholder(steg);
  endAction(steg->features);
  for (fiter = collections.begin(); fiter != collections.end(); fiter++) {
    if (fiter->second != 0) {
//       printf("<%i, %i> \n", fiter->first.first, fiter->first.second);
      citer = fiter->second->iterator();
      while (citer->hasNext()) {
	steg->features = citer->next();
// 	printf("About to estimate mu with dim=%i, M=%i \n", steg->features->dim, steg->features->M);
	startAction(steg->features);
	estimateMu(steg);
	endAction(steg->features);
// 	progressChanged((double) i / (double) j);
      }
    }
  }
  steg->features = cleanSet;
  modelChanged();
}
Ejemplo n.º 3
0
static PyObject *pyStartAction(PyObject *self, PyObject *args) {
    void *handle;
    if (!PyArg_ParseTuple(args, "l", &handle)) {
        PyErr_SetString(RulesError, "pyStartAction Invalid argument");
        return NULL;
    }
    
    char *state;
    char *messages;
    void *actionHandle;
    void *actionBinding;
    unsigned int result = startAction(handle, &state, &messages, &actionHandle, &actionBinding);
    if (result == ERR_NO_ACTION_AVAILABLE) {
        Py_RETURN_NONE;
    } else if (result != RULES_OK) {
        if (result == ERR_OUT_OF_MEMORY) {
            PyErr_NoMemory();
        } else { 
            char *message;
            if (asprintf(&message, "Could not start action, error code: %d", result)) {
                PyErr_NoMemory();
            } else {
                PyErr_SetString(RulesError, message);
                free(message);
            }
        }
        return NULL;
    }

    PyObject *returnValue = Py_BuildValue("ssll", state, messages, actionHandle, actionBinding);
    return returnValue;
}
Ejemplo n.º 4
0
void ItemTaskGroup::nextItem()
{
	onProgressUpdate(100);

	UserCore::Item::ItemHandleI* item = getActiveItem();

	if (item)
		item->delHelper(this);

	if (m_uiActiveItem+1 >=  m_vWaitingList.size())
	{
		m_uiLastActive = m_uiActiveItem;
		m_uiActiveItem = UINT_MAX;

		if (m_bFinal)
			finish();
	}
	else
	{
		if (m_uiLastActive != UINT_MAX)
		{
			m_uiActiveItem = m_uiLastActive;
			m_uiLastActive = UINT_MAX;
		}

		m_uiActiveItem++;

		item = getActiveItem();
		item->addHelper(this);
		startAction(dynamic_cast<UserCore::Item::ItemHandle*>(item));
	}
}
Ejemplo n.º 5
0
static VALUE rbStartAction(VALUE self, VALUE handle) {
    Check_Type(handle, T_FIXNUM);

    char *state;
    char *messages;
    void *actionHandle;
    void *actionBinding;
    unsigned int result = startAction((void *)FIX2LONG(handle), &state, &messages, &actionHandle, &actionBinding);
    if (result == ERR_NO_ACTION_AVAILABLE) {
        return Qnil;
    } else if (result != RULES_OK) {
        if (result == ERR_OUT_OF_MEMORY) {
            rb_raise(rb_eNoMemError, "Out of memory");
        } else { 
            rb_raise(rb_eException, "Could not start action, error code: %d", result);
        }
    }

    VALUE output = rb_ary_new(); 
    rb_ary_push(output, rb_str_new2(state));
    rb_ary_push(output, rb_str_new2(messages));
    rb_ary_push(output, INT2FIX(actionHandle));
    rb_ary_push(output, INT2FIX(actionBinding));
    return output;
}
Ejemplo n.º 6
0
/**
* \brief Default constructor
*/
SpecificWorker::SpecificWorker(MapPrx& mprx) : GenericWorker(mprx)
{
 inner = new InnerModel("/home/robocomp/Software/robotica/Robotica2015/apartament.xml");
 //inner = new InnerModel("/home/robocomp/Escritorio/Robotica2015/apartament.xml");
 
	InnerModelLaser *lm;
	if ((lm = dynamic_cast<InnerModelLaser *>(inner->getNode("laser"))) != NULL)
		LASER_MAX = lm->max;
	else
		qFatal("Fatal error. Laser element not found in XML file");
 
	//Inir random seed
 qsrand(QTime::currentTime().msec());
 
 //add robot node
 lemon::ListGraph::Node robot = graph.addNode();
 map = new lemon::ListGraph::NodeMap<QVec>(graph);

  try
	{
		differentialrobot_proxy->getBaseState(bState);
		inner->updateTransformValues("robot", bState.x, 0, bState.z, 0, bState.alpha, 0);	//actualiza los valores del robot en el arbol de memoria
		map->set(robot, inner->transform("world","robot"));
		robotNode = lemon::ListGraph::NodeIt(graph,robot);
		
		qDebug() << __FUNCTION__<< "Robot inserted in the graph at " << inner->transform("world","robot");
	}
	catch(const Ice::Exception &ex){ std::cout << ex.what() << std::endl;}; 
	
  edgeMap = new lemon::ListGraph::EdgeMap<float>(graph);
	
	//Innermodelviewer
	osgView = new OsgView( frame );
	osgGA::TrackballManipulator *tb = new osgGA::TrackballManipulator;
	osg::Vec3d eye(osg::Vec3(4000.,4000.,-1000.));
	osg::Vec3d center(osg::Vec3(0.,0.,-0.));
	osg::Vec3d up(osg::Vec3(0.,-1.,0.));
	tb->setHomePosition(eye, center, up, true);
	osg::Matrixf m;
	m.set( 0.998955, -0.0011, -0.09798, 0, -0.0798273, 0.0116788, -0.998538, 0, 0.000867, 0.997709, 0.0153157, 0, 4585.27, 11113.77, 4683.92, 1); 
	//tb->setByMatrix(osg::Matrixf::lookAt(eye,center,up));
	tb->setByMatrix(m);
 	osgView->setCameraManipulator(tb);
	innerViewer = new InnerModelViewer(inner, "root", osgView->getRootGroup(), true);
	
	//draw the initial position of the roobt
	InnerModelDraw::addPlane_ignoreExisting(innerViewer, "vertex_0", "world", inner->transform("world","robot"), 
																					QVec::vec3(1,0,0), "#00ff00", QVec::vec3(100,100,100));
	//Init closestNode
	closestNode = robotNode;

	//UI
	connect(startButton, SIGNAL(clicked()), this, SLOT(startAction()));
	connect(stopButton, SIGNAL(clicked()), this, SLOT(stopAction()));
	
}
Ejemplo n.º 7
0
void TickerTape::startTicker() {
	m_rootWindow->registerUpdate(this);
	startAction(0);
}