示例#1
0
int secuencial(struct wavelet *wave, IplImage *img1, IplImage *img2)
{
	float *psicoefs, *phicoefs; uint ncoefs;
	uint w, h, c, k;
	float *signal1, *signal2, *sigh;

    int i;

	seqGetCoefs(wave, (float **)&phicoefs, (float **)&psicoefs, &ncoefs);

    for(i=0; i < ncoefs; i++)
        printf("phi[%d]=%.2f  psi[%d]=%.2f\n",i,phicoefs[i],i,psicoefs[i]);

	w = img1->width;
	h = img1->height;
	c = img1->nChannels;
	
	signal1 = (float *) malloc(sizeof(float) * w * h * c);
	signal2 = (float *) malloc(sizeof(float) * w * h * c);
	
	img2signal(img1, signal1);
	cvShowImage("ORIGINAL",img1);
	cvWaitKey(0);	

	for(k=0; k<6; k++) {

		filas(signal1, signal2, w, h, c, phicoefs, psicoefs, ncoefs,
		img1->width,img1->height);
		columnas(signal2, signal1, w, h, c, phicoefs, psicoefs, ncoefs,
		img1->width,img1->height);

		view(signal1, img1);
		w /= 2;
		h /= 2;
	}

}
示例#2
0
bool Vista::loadMedia() {
	/**Creo el dibujo del pasto**/

	vector<dibujo_t> pastos;
	for (int nroTextura = 1; nroTextura <= MAX_NRO_TEXTURA; nroTextura++) {

		Entidad* entidadPasto =
				this->modelo->juego->escenario->getTexturaDefault(nroTextura);
		this->factory->crear_dibujo_tile(entidadPasto->objetoMapa->imagen);
		dibujo_t pasto_id = this->factory->ultimo_dibujo();
		pastos.push_back(pasto_id);

		delete entidadPasto;

	}

	std::map<std::string, ObjetoMapa*>::iterator it;
	std::map<std::string, dibujo_t> hashDibujos;

	Configuracion* configuracion = this->modelo->juego->conf;
	for (it = modelo->juego->tipos.begin(); it != modelo->juego->tipos.end();
			it++) {
		ObjetoMapa* tipo = it->second;
		vector<int> v1d =
				{ tipo->pixelsReferencia->x, tipo->pixelsReferencia->y };
		if (tipo->fps == 0) {
			this->factory->crear_dibujo_estatico(tipo->imagen, v1d);
		} else if (tipo->delay != 0) {
			this->factory->crear_dibujo_animado(tipo->imagen, v1d, tipo->fps,
					tipo->delay);
		} else {
			this->factory->crear_dibujo_personaje(tipo->imagen, tipo->musica,MOVIMIENTOS, CANTIDAD_DE_IMAGENES, tipo->fps); //el ultimo parametro es velocidad
		}
		dibujo_t dibujo_id = this->factory->ultimo_dibujo();
		hashDibujos[tipo->nombre] = dibujo_id;
	}
	this->factory->setHashDibujos(hashDibujos);
	/**Dibujo el mapa**/
	int largo = this->modelo->get_alto_mapa();
	int ancho = this->modelo->get_ancho_mapa();
	vector<vector<dibujo_t>> filas(ancho, pastos);
	vector<vector<vector<dibujo_t>>> tiles(largo, filas);
	vector<dibujo_t> filas_escenario(ancho, 0);
	vector<vector<dibujo_t>> escenario(largo, filas_escenario);

	//***********DIBUJOS (ENTIDADES ESTATICAS Y DINAMICAS EN YAML)*****************
	for (unsigned i = 0; i < this->modelo->juego->escenario->entidades.size();
			i++) {
		Entidad* entidad = this->modelo->juego->escenario->entidades[i];
		escenario[entidad->posicion->getX()][entidad->posicion->getY()] =
				hashDibujos[entidad->objetoMapa->nombre];
	}
	modelo->setDibujoMapa(escenario, tiles); //MEZCLA VISTA CON MODELO

	this->barra->load(gRenderer, "font.ttf", this->ancho_por_celda(),
			this->altura_por_celda());
	musica_creacion = Mix_LoadWAV( "img/1elfos/CREACION.wav" );
	musicaLoading = Mix_LoadWAV( "img/extras/loading.wav" );
	music_ganador_elfo=Mix_LoadWAV( "img/1elfos/GANADOR.wav" );
	musica_ganador_hobbit=Mix_LoadWAV( "img/2hobbit/GANADOR.wav" );
	musica_ganador_humanos=Mix_LoadWAV( "img/3humanos/GANADOR.wav" );
	musica_ganador_mordor=Mix_LoadWAV( "img/4mordor/GANADOR.wav" );

	return true;
}