Ejemplo n.º 1
0
int matrixofpixels::getmaskedofpixels(QString namefilewithmask)
{    
    if (!ifmatrixmaskfile(namefilewithmask))
    {
        QMessageBox::information(0,"Information","File does not contain information \nabout the masked pixels or is empty");
        return 0;
    }
    const char* charnamefilewithmask = namefilewithmask.toLocal8Bit().constData();

    float tmpint;
    int tmpperc=0;
    std::ifstream inmask(charnamefilewithmask);

    if (maskdatavector.size()>0) maskdatavector.clear();

    for (int i=0;i<Npix;i++)
    {
        for (int j=0;j<Npix;j++)
        {
            inmask >> tmpint;
            masked[i][j] = tmpint;
            if (tmpint) tmpperc++;
            maskdatavector.push_back((double)tmpint);
        }
    }
//#######    if (ZoomInd) {delete myzoom; ZoomInd = false;}
    numofnotmasked = tmpperc;
    inmask.close();
    return 1;
}
Ejemplo n.º 2
0
int
main(int argc, char** argv){

 
 if(argc != 5){
     Usage(argc,argv);
     return 1;
 }
	 
 // amount of mask attenuation (dB)
 float amount = (float)pow(10, atof(argv[4])/20.f);
 
 // masking file
 SndWave inmask(argv[2], READ);
 // input file
 SndWave infile(argv[1], READ);

 // Hamming window
 HammingTable window(DEF_FFTSIZE, 0.54f);
 // masking table
 PVTable table2(DEF_FFTSIZE,&inmask,&window, 0.f, 1.f);

 // input signal
 SndIn  in(&infile);
 // PV analysis
 PVA   anal(&window, &in, 0.6f);
 // Masking
 PVMask mask(amount, &table2, &anal);
 // PV synthesis
 PVS   synth(&window, &mask);
 // output file
 SndWave  output(argv[3], OVERWRITE, 1);
 output.SetOutput(1, &synth);
 // processing loop
 while(!infile.Eof()){ 

   infile.Read();
   in.DoProcess();
   anal.DoProcess();
   mask.DoProcess();
   synth.DoProcess();
   output.Write();  
   
}

return 0;

}