void startProcess() { cout<<"process is started"<<endl; cv::pyrDown(image,image); cv::pyrDown(imageDup,imageDup); cv::pyrDown(colorDup,colorDup); cv::pyrDown(colorImage,colorImage); cv::pyrDown(finalImage,finalImage); cv::pyrDown(randomPatchImage,randomPatchImage); //cv::pyrDown(randomPatchesCreation,randomPatchesCreation); cv::pyrDown(randomPatchDup,randomPatchDup); cv::pyrDown(randomMappedImage,randomMappedImage); initiation(); propogation(); cout<<"propogation phase is completed"<<endl; cv::imshow("random patches after propogation",randomPatchDup); addtoImage(); cv::imshow("complete image with random patches after propogation",imageDup); randomSearch(40); cv::imshow("complete image after random search",imageDup); }
// // This function is called from the GUI void faxDecoder::fax_setIOC (const QString &s) { int numberofSamples; faxParams *myfaxParameters = getFaxParams (s); fax_IOC = myfaxParameters -> IOC; numberofColums = M_PI * fax_IOC; startSetter -> setValue (myfaxParameters -> aptStart); stopSetter -> setValue (myfaxParameters -> aptStop); lpmSetter -> setValue (myfaxParameters -> lpm); lpm = myfaxParameters -> lpm; samplesperLine = theRate * 60 / lpm; numberofColums = M_PI * fax_IOC; lastRow = 100; // will change lastRow = 100; pixelValue = 0; currentSampleIndex = 0; if (faxState != FAX_DONE) { delete theImage; theImage = new faxImage (numberofColums, lastRow); rawData. resize (1024 * 1024); theImage -> clear (); fax_displayImage (theImage -> getImage ()); return; } /* * apply the changes to the current image */ numberofSamples = rawData. size (); for (int i = 0; i < numberofSamples; i ++) { addtoImage (rawData [i]); } }
void faxDecoder::fax_setLPM (float f) { int64_t numberofSamples; if (faxState != FAX_DONE) // just ignore return; lpm = f; pixelValue = 0; pixelSamples = 0; currentSampleIndex = 0; lastRow = 100; currentColumn = 0; numberofSamples = rawData. size (); for (int i = 0; i < numberofSamples; i ++) { addtoImage (rawData [i]); } }
void faxDecoder::doDecode (DSPCOMPLEX z) { int16_t sampleValue; // // for the sound: outputSample (real (z), imag (z)); // // When we are in autoContinue mode, we just wait at least for // 30 seconds after detecting the FAX_DONE before resetting if (faxState == FAX_DONE) { if (autoContinue && delayCounter ++ > theRate * 30) { reset (); // will a.o set the state delayCounter = 0; } else return; } z = z * localOscillator -> nextValue (carrier); z = faxLowPass -> Pass (z); sampleValue = myDemodulator -> demodulate (z); if (phaseInvers) sampleValue = 256 - sampleValue; if (faxColor == FAX_BLACKWHITE) sampleValue = isWhite (sampleValue) ? 255 : 0; fax_oldz = z; currentValue = sampleValue; // We count the number of times the decoded values // goes up from black to white. If in a period of half a second // (i.e. we had theRate / 2 samples), the number // of upCrossings is aptStartFreq / 2, we have a start // if the number is aptStopFreq and we are // not DONE or APT_START then we finish the transmission if (we_are_Black && realWhite (sampleValue)) { whiteSide = true; apt_upCrossings ++; } else if (whiteSide && realBlack (sampleValue)) whiteSide = false; // if we have samples for about half a second of samples, // check the frequency // to see whether we are ready for phasing or for exit if (++aptCount >= theRate / 2) { int16_t freq = 2 * apt_upCrossings; aptFreq -> display (freq); aptCount = 0; apt_upCrossings = 0; if ((faxState == APTSTART) && inRange (freq, aptStartFreq)) { faxState = FAX_PHASING; // carrier -= freq - aptStartFreq; initPhasing (); return; } if (((faxState & (FAX_PHASING | FAX_IMAGING)) != 0) && inRange (freq, aptStopFreq)) { rawData. resize (currentSampleIndex); faxState = FAX_DONE; showState -> setText (QString ("Done")); fax_displayImage (theImage -> getImage (), 0, faxColor == FAX_COLOR ? lastRow / 3 : lastRow); if (savingRequested || autoContinue) { fax_saveFile (theImage -> getImage (), autoContinue); set_savingRequested (false); } return; } // // otherwise: fall through } if (faxState == FAX_PHASING) addtoPhasing (sampleValue); if ((faxState == FAX_PHASING) || (faxState == FAX_IMAGING)) if (lpm > 0) // just a precaution addtoImage (sampleValue); }