void CorrectedRadialProfileTest() { // read image const char* imgname = "SingleBead.jpg"; ImageData img = ReadJPEGFile(imgname); // localize CPUTracker trk(img.w,img.h); trk.SetImageFloat(img.data); vector2f com = trk.ComputeMeanAndCOM(); bool boundaryHit; vector2f qi = trk.ComputeQI(com, 4, 64, 64,ANGSTEPF, 1, 30, boundaryHit); dbgprintf("%s: COM: %f, %f. QI: %f, %f\n", imgname, com.x, com.y, qi.x, qi.y); std::vector<float> angularProfile(128); float asym = trk.ComputeAsymmetry(qi, 64, angularProfile.size(), 1, 30, &angularProfile[0]); // ComputeAngularProfile(&angularProfile[0], 64, angularProfile.size(), 1, 30, qi, &img, trk.mean); WriteImageAsCSV("angprof.csv", &angularProfile[0], angularProfile.size(), 1); dbgprintf("Asymmetry value: %f\n", asym); std::vector<float> crp(128); float* crpmap = new float[angularProfile.size()*crp.size()]; ComputeCRP(&crp[0], crp.size(), angularProfile.size(), 1, 30, qi, &img, 0.0f); WriteImageAsCSV("crpmap.csv", crpmap, crp.size(), angularProfile.size()); delete[] crpmap; delete[] img.data; //CRP_TestGeneratedData(); // GenerateImageFromLUT(ImageData(img,w,h), ImageData }
bool BufferedLoggerMark::flush() { if(_mst.size()>0){ if (crp()) _mst.cr(); logs(0, _mst.as_string()); _mst.reset(); return true; } return false; }
bool BufferedLoggerMark::enter() { if(_mst.size()>0){ if (crp()) _mst.cr(); logs(Log::ENTER, _mst.as_string()); _mst.reset(); } else { logs(Log::ENTER, "begin\n"); } _depth++; return true; }
bool BufferedLoggerMark::leave() { if (_depth > 0) { _depth--; if(_mst.size()>0){ if (crp()) _mst.cr(); logs(Log::LEAVE, _mst.as_string()); _mst.reset(); } else { logs(Log::LEAVE, "done\n"); } return true; } return false; }
void MbtoolUpdater::Impl::patchInitRc(CpioFile *cpio) { std::vector<unsigned char> contents; cpio->contents("init.rc", &contents); std::vector<std::string> lines; boost::split(lines, contents, boost::is_any_of("\n")); std::regex whitespace("^\\s*$"); bool insideService = false; // Remove old mbtooldaemon service definition for (auto it = lines.begin(); it != lines.end();) { if (boost::starts_with(*it, "service")) { insideService = it->find("mbtooldaemon") != std::string::npos; } else if (insideService && std::regex_search(*it, whitespace)) { insideService = false; } if (insideService) { it = lines.erase(it); } else { ++it; } } std::string strContents = boost::join(lines, "\n"); contents.assign(strContents.begin(), strContents.end()); cpio->setContents("init.rc", std::move(contents)); CoreRamdiskPatcher crp(pc, info, cpio); if (!cpio->exists("init.multiboot.rc")) { crp.addMultiBootRc(); } crp.addDaemonService(); crp.addAppsyncService(); crp.disableInstalldService(); crp.fixDataMediaContext(); crp.removeRestorecon(); }
int main(int argc, char* argv[]) { const std::string testKey = "abcdfgteqsdfrtedfsretkdpbdltesas"; Crypto28147SimpleReplacement crp(testKey); std::string encrypted; std::string decrypted; if (argc > 1) { if (0 == strcmp(argv[1], "-encr")) { std::cin >> std::noskipws; std::istream_iterator<char> it(std::cin); std::istream_iterator<char> end; std::string inputLine(it, end); crp.encrypt(inputLine, encrypted); std::cout << encrypted << std::endl; } else if (0 == strcmp(argv[1], "-decr"))