Status space_setSDesc(Space * s, char *sdesc) { assert(s && sdesc); if (!sDesc(s)) sDesc(s) = strdup(sdesc); return OK; }
void space_free(Space *s){ int i; if(!s) return; if(sDesc(s)) free (sDesc(s)); if(lDesc(s)) free (lDesc(s)); if(map(s)){ for(i = 0; i < rows(s); i++){ if(map(s)[i]) free (map(s)[i]); } free(map(s)); } free(s); }
char *space_getSDesc(Space * s) { char* description = NULL; if (!s) return NULL; description = strdup(sDesc(s)); return description; }
BOOL CGridDevListCtrl::UpdateDevList(BOOL newDevicesOnly) { if (newDevicesOnly) g_App->Wdi.CreateList(FALSE, FALSE); else g_App->Wdi.CreateList(TRUE, TRUE); DeleteAllItems(); // Insert data into list-control by copying from datamodel for (int iRow = 0; iRow < g_App->Wdi.DeviceItemArray.GetCount(); iRow++) { PWDI_DEVICE_INFO devInfo = g_App->Wdi.DeviceItemArray.GetAt(iRow); CString sDesc(devInfo->desc); CString sDriver(devInfo->driver); CString sVendorName(g_App->Wdi.GetVendorName(devInfo->vid)); CString sVid, sPid; sVid.Format(_T("0x%04x"), devInfo->vid); sPid.Format(_T("0x%04x"), devInfo->pid); InsertItem(iRow, sVendorName); SetItemData(iRow, (DWORD_PTR)devInfo); for(int iCol = 1; iCol < GetColumnCount(); iCol++) { switch(iCol) { case 1: // Vid SetItemText(iRow, iCol, sVid); break; case 2: // Pid SetItemText(iRow, iCol, sPid); break; case 3: // Description SetItemText(iRow, iCol, sDesc); break; case 4: // Driver if (sDriver.IsEmpty()) SetItemText(iRow, iCol, _T("(None)")); else SetItemText(iRow, iCol, sDriver); break; default: ASSERT(FALSE); } } } return TRUE; }
Space * space_ini() { int i; Space *s; s = (Space *) malloc(sizeof(Space)); if (!s) return NULL; sId(s) = -1; sDesc(s) = NULL; lDesc(s) = NULL; light(s) = FALSE; isLocked(s) = FALSE; map(s) = NULL; rows(s) = -1; cols(s) = -1; numdoors(s) = -1; doors(s) = NULL; return s; }
Space * space_ini(){ int i; Space *s; s = (Space *) malloc (sizeof(Space)); if(!s) return NULL; sId(s) = -1; for(i = 0; i < 8; i++) neighbour(s)[i] = -1; sDesc(s) = NULL; lDesc(s) = NULL; light(s) = FALSE; isLocked(s) = FALSE; map(s) = NULL; rows(s) = -1; cols(s) = -1; return s; }
void R3DFeaturesThread::processWorkItem(wxString &workItem) { //Image<unsigned char> imageGray; openMVG::image::Image<float> imageGray; Regard3DFeatures::KeypointSetR3D kpSet; wxFileName fnImage(workItem); wxFileName fnFeature, fnDesc; fnFeature.SetPath(pTasks_->outDir_); fnFeature.SetName(fnImage.GetName()); fnFeature.SetExt(wxT("feat")); fnDesc.Assign(fnFeature); fnDesc.SetExt(wxT("desc")); //Test if descriptor and feature was already computed if(fnFeature.FileExists() && fnDesc.FileExists()) { } else { // Convert back to C string std::string filename(workItem.mb_str()); std::string sFeat(fnFeature.GetFullPath().mb_str()); std::string sDesc(fnDesc.GetFullPath().mb_str()); //Not already computed, so compute and save // if (!openMVG::ReadImage(filename.c_str(), &imageGray)) // return; int cols = imageGray.cols(); int rows = imageGray.rows(); // Load image, convert to float, then to gray image // Note: This is probably neither the fastest, nor the most space-efficient way to do this, // but this way achieves better quality than by first converting an uchar-RGB-image to uchar-gray // which involves quantization. { cv::Mat cvimg; cvimg = cv::imread(filename.c_str(), cv::ImreadModes::IMREAD_COLOR | cv::ImreadModes::IMREAD_IGNORE_ORIENTATION); int type = cvimg.type(); if(type == CV_32F) { int jj = 27; } else if(type == CV_8UC3) { int jj = 27; } // Channels int channels = cvimg.channels(); int w = cvimg.cols; int h = cvimg.rows; // Convert to float cv::Mat cvimg_float; cvimg.convertTo(cvimg_float, CV_32FC3, 1.0/255.0, 0); cvimg.release(); // Dispose of memory // Convert to gray cv::Mat cvimg_gray; cv::cvtColor(cvimg_float, cvimg_gray, cv::COLOR_BGR2GRAY); cvimg_float.release(); // Dispose of memory type = cvimg_gray.type(); channels = cvimg_gray.channels(); imageGray = Eigen::Map<openMVG::image::Image<float>::Base>(cvimg_gray.ptr<float>(0), h, w); cvimg_gray.release(); // Dispose of memory int cols2 = imageGray.cols(); int rows2 = imageGray.rows(); } // Compute features and descriptors and export them to file Regard3DFeatures::detectAndExtract(imageGray, kpSet.features(), kpSet.descriptors(), pTasks_->params_); kpSet.saveToBinFile(sFeat, sDesc); { wxMutexLocker lock(*pMutex_); doneCount_++; numberOfKeypoints_.push_back(static_cast<int>(kpSet.features().size())); } sendMsgToMainFrame(workItem, kpSet.features().size()); } }