/* Define a symbol for current location: A$FILE$line# */ void DefineCDB_Line() { char name[ NCPS ]; struct sym *pSym; /* symbol is FILE.nnn */ sprintf( name, "A$%s$%u", BaseFileName( cfile ), srcline[ cfile ] ); pSym = lookup( name ); pSym->s_type = S_USER; pSym->s_area = dot.s_area; pSym->s_addr = laddr; pSym->s_flag |= S_GBL; }
const string& CVC::DetectorFile() { const string fn = CurrentFullDataFileName(); auto d = detectorfile_map.find(fn); if (d==detectorfile_map.end()) { while (detectorfile_map.size()) { Unlink(detectorfile_map.begin()->second); detectorfile_map.erase(detectorfile_map.begin()); } pair<bool,string> tmp = TempFile("cvc_detector_"); string dn = tmp.second+BaseFileName()+".txt"; if (FileVerbose()) cout << "SOON creating <" << dn << ">" << endl; size_t g = grid; size_t y0 = g-1, x0 = g-1, y1 = Height()-g, x1 = Width()-g; size_t dy = g, dx = g; if (!g) { y0 = Height()/2; x0 = Width()/2; y1 = y0+1; x1 = x0+1; dx = dy = Width()+Height(); } list<pair<size_t,size_t> > l; for (size_t y=y0; y<y1; y+=dy) for (size_t x=x0; x<x1; x+=dx) l.push_back(make_pair(x, y)); ofstream os(dn); os << "KOEN1" << endl << "0" << endl << l.size() << endl; for (auto i=l.begin(); i!=l.end(); i++) os << "<CIRCLE " << i->first << " " << i->second << " " << radius << " 0 0>;;" << endl; detectorfile_map[fn] = dn; d = detectorfile_map.find(fn); } return d->second; }
VOID DefineSDCC_Line (void) { struct dbuf_s dbuf; struct sym *pSym; /* * Symbol is A$FILE$nnn */ dbuf_init (&dbuf, NCPS); dbuf_printf (&dbuf, "A$%s$%u", BaseFileName (cfile, 1), srcline[cfile]); pSym = lookup (dbuf_c_str (&dbuf)); dbuf_destroy (&dbuf); pSym->s_type = S_USER; pSym->s_area = dot.s_area; pSym->s_addr = laddr; pSym->s_flag |= S_GBL; }
VOID DefineNoICE_Line (void) { struct dbuf_s dbuf; struct sym *pSym; /* * Symbol is FILE.nnn */ dbuf_init (&dbuf, NCPS); dbuf_printf (&dbuf, "%s.%u", BaseFileName (asmc, 0), srcline); pSym = lookup (dbuf_c_str (&dbuf)); dbuf_destroy (&dbuf); pSym->s_type = S_USER; pSym->s_area = dot.s_area; pSym->s_addr = laddr; pSym->s_flag |= S_GBL; }
VoidT SetupOMHIniDialog(StringT filename, F_ObjHandleT bookId) { F_ObjHandleT dlgId = 0; F_ObjHandleT compId = 0; StringT basename = NULL; StringT compname = NULL; StringT topicfile = NULL; basename = BaseFileName(filename); /* open resource for OMH Settings dialog box. */ dlgId = F_ApiOpenResource(FO_DialogResource, "m2rsetc"); DlgIds[DLG_SETUP_OMH_INI - 1] = dlgId; /* set CurrProjectName and Path at top of dialog */ SetDlgProject(dlgId, DLG_SC_PROJDESC); /* set up name for [MAP] file */ CshMapFileSet = False; CshMapFile = NULL; //SetDlgText(dlgId, DLG_SC_CSHMAP, "resource.h"); /* set checkboxes for TOC and IX inclusion and search generation */ UseFmTOC = UseFmIX = False; UseFmGenFiles = True; UseOHTOC = UseOHIX = UseOHFTS = UseOHREL = True; /* these are always the same */ GenTOC = GenIX = True; WrapAndShip = True; SetDlgState(dlgId, DLG_SC_FM_TOC, UseFmTOC); SetDlgState(dlgId, DLG_SC_FM_IX, UseFmIX); SetDlgState(dlgId, DLG_SC_FM_GEN, UseFmGenFiles); SetDlgState(dlgId, DLG_SC_USE_TOC, UseOHTOC); SetDlgState(dlgId, DLG_SC_USE_IX, UseOHIX); SetDlgState(dlgId, DLG_SC_USE_FTS, UseOHFTS); SetDlgState(dlgId, DLG_SC_USE_REL, UseOHREL); #if 0 SetDlgState(dlgId, DLG_SC_COPY_TO, WrapAndShip); SetDlgText(dlgId, DLG_SC_HP_PATH, WrapPath); SetDlgText(dlgId, DLG_SC_VW_PATH, OHVName); #endif if (bookId) { /* get basename of first file in book */ compId = F_ApiGetId(FV_SessionId, bookId, FP_FirstComponentInBook); compname = F_ApiGetString(bookId, compId, FP_Name); topicfile = BaseFileName(compname); F_StrFree(compname); } else topicfile = F_StrCopyString(basename); SetDlgText(dlgId, DLG_SC_CONTENTS, topicfile); DefaultTopicFile = NULL; TopicFileSet = False; SetDlgText(dlgId, DLG_SC_PROJECT, basename); /* put dummy title */ SetDlgText(dlgId, DLG_SC_TITLE, HelpTitle); UseCSS = True; CssFileName = "ohmain.css"; SetDlgText(dlgId, DLG_SC_CSS, CssFileName); /* turn off everything under template */ SetFrameTemplateDlg(dlgId, DLG_SC_TPL_CK); SetupCancelled = True; /* default if closed */ F_ApiModalDialog(DLG_SETUP_OMH_INI, dlgId); WriteEqns = True; WriteAllGraphics = True; F_StrFree(basename); }
bool OCVLbp::CalculateOpenCV(int /*f*/, int l) { static const string msg = "OCVLbp::CalculateOpenCV() : "; featureVector fv; if (LabelVerbose()) cout << msg << "starting" << endl; bool ok = true; if (spoints.empty()) CreateSPoints(); if (!ok || spoints.empty() || (spoints.size() != options.nneighbors)) { cerr << msg << "Missing or wrong pixel neighborhood." << endl; return false; } if (options.lbptype == CSLBP) { if (options.neighborhood != LBP_CIRCULAR) { cerr << msg << "CS-LBP requires (currently) a circular neighborhood" << endl; return false; } else if (options.mapping != LBP_MAPPING_NONE) { cerr << msg << "CS-LBP is not compatible with any mappings" << endl; return false; } } if ((options.mapping != LBP_MAPPING_NONE) && lbp_map.mapsize == 0) CreateMap(); // lbp_image = // ocv_image_(Rect(options.crop.x0, options.crop.y0, // ocv_image_.cols-options.crop.x0-options.crop.x1, // ocv_image_.rows-options.crop.y0-options.crop.y1)); lbp_image = ocv_image_; if (options.write_image) { string sn; if ((size_t)l<RegionDescriptorCount()) sn = RegionDescriptor(l).first; else sn = ToStr(l); //string oname = "lbp-"+BaseFileName()+"-"+ToStr(f)+"-"+ToStr(l)+".jpg"; string oname = "lbp-"+BaseFileName()+"_"+sn+".jpg"; imwrite(oname, lbp_image); } if (blocktypes.empty()) blocktypes.push_back(BLOCKS_1x1); CreateBlocks(); MatND storedhist; list<pair<Rect,lbp_block_type> >::const_iterator i; for (i = lbp_blocks.begin(); i!=lbp_blocks.end(); i++) { MatND hist; Mat blockimg = lbp_image(i->first); CalculateLbp(blockimg, hist); if (i->second == BLOCK_STORE) storedhist = hist; else if (i->second == BLOCK_SUBTRACT) hist -= storedhist; if (options.normalize_histogram != HISTNORM_NONE) { Scalar sumhist = sum(hist); hist /= sumhist[0]; } if (options.normalize_histogram == HISTNORM_CAPPED) { for (int ii=0; ii<hist.rows; ii++) if (hist.at<float>(ii)>0.2) hist.at<float>(ii) = 0.2; Scalar sumhist = sum(hist); hist /= sumhist[0]; } for (int ii=0; ii<hist.rows; ii++) fv.push_back(hist.at<float>(ii)); } SetVectorData(l, fv); if (LabelVerbose()) cout << msg << "ending" << endl; return true; }