touchCalibration_t::touchCalibration_t( void ) : data_( 0 ) { char inbuf[80]; snprintf(inbuf,sizeof(inbuf), "t%ux%u", SCREENWIDTH(), SCREENHEIGHT() ); char const *flashVar = readFlashVar(inbuf); if( flashVar ){ setCalibration( flashVar ); return ; } else { char calPath[512]; snprintf( calPath, sizeof(calPath), "/mmc/%s.dat", inbuf ); FILE *fIn = fopen(calPath, "r"); if( fIn ){ bool haveData = false ; char tmp[512]; if(fgets(tmp,sizeof(tmp),fIn)){ setCalibration(tmp); haveData = true ; } fclose(fIn); if(haveData) return ; } else perror(calPath); } fprintf( stderr, "%s: no touch screen settings\n", inbuf ); }
/** * \brief Slot called when the databas button is clicked * * It opens a calibrationselectiondialog to select a clibration appropriate * for this device. */ void calibrationwidget::databaseClicked() { debug(LOG_DEBUG, DEBUG_LOG, 0, "create a calibration selection"); calibrationselectiondialog *selection = new calibrationselectiondialog(this); debug(LOG_DEBUG, DEBUG_LOG, 0, "set up the guider in the selection"); selection->setGuider(_controltype, _guiderdescriptor, _guiderfactory); connect(selection, SIGNAL(calibrationSelected(snowstar::Calibration)), this, SLOT(setCalibration(snowstar::Calibration))); selection->show(); }
void simpleCalibration( double focal = 520.0 ) { if ( !load_images ) { DEBUG_E( ("Not loaded Images. Use properly the constructor or set parameters manually") ); exit(-1); } double wimg = image1->size().width - 1.0; double himg = image1->size().height - 1.0; Eigen::Matrix3d K; K << focal, 0.0, wimg/2, 0.0, focal, himg/2, 0.0, 0.0, 1.0; // Camera Matrix (intrinsics) setCalibration( K ); }
CTWithWater::CTWithWater(const CalibrationData& calibrationData, double water_depth) : m_dWaterDepth(water_depth), m_CameraMatrix(NULL), m_DistCoeffs(NULL), m_Rv(NULL), m_R(NULL), m_T(NULL), m_CameraWorld(NULL), m_S(NULL), m_CameraMatrixNorm(NULL), m_DistCoeffsNorm(NULL) { allocMatrices(); setCalibration(calibrationData); }
int gui::TreeWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: updateActions((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; case 1: updateActions(); break; case 2: clickedTree((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; case 3: { string _r = ObtType((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< string*>(_a[0]) = _r; } break; case 4: insertChild(); break; case 5: { bool _r = insertColumn((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 6: { bool _r = insertColumn(); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 7: insertRow(); break; case 8: { bool _r = removeColumn((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 9: { bool _r = removeColumn(); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 10: removeRow(); break; case 11: editObject(); break; case 12: saveShow(); break; case 13: loadShow(); break; case 14: setOrbitmode(); break; case 15: setRollmode(); break; case 16: setDollymode(); break; case 17: setPanymode(); break; case 18: setCalibration(); break; case 19: quit(); break; default: ; } _id -= 20; } return _id; }
GraphPose( Eigen::Matrix3d &Calib ) { setCalibration( Calib ); fallback_icp = false; initializePtrs(); };
void handleDisplayChange(XRRScreenChangeNotifyEvent *evt) { int screenWidth, screenHeight; if(evt==NULL) { screenWidth = lastScreenWidth; screenHeight = lastScreenHeight; } else { screenWidth = evt->width; lastScreenWidth = screenWidth; screenHeight = evt->height; lastScreenHeight = screenHeight; } if(debugMode) { printf("Screen size: %ix%i\n", screenWidth, screenHeight); } XRRScreenResources *res = XRRGetScreenResourcesCurrent(display, root); int d; for(d = 0; d < profiles.nDeviceSettings; d++) { if(profiles.deviceSettings[d].attachedOutput == NULL && !(profiles.deviceSettings[d].autoOutput)) { /* Set calibration of whole screen */ int id = 0; for(id = 0; id<profiles.deviceSettings[d].inputDeviceCount; id++) { if(debugMode) { printf("Calibrate Device with ID %i\n", profiles.deviceSettings[d].inputDeviceIDs[id]); } setCalibration(profiles.deviceSettings[d].inputDeviceIDs[id], profiles.deviceSettings[d].outputMinX, profiles.deviceSettings[d].outputMaxX, profiles.deviceSettings[d].outputMinY, profiles.deviceSettings[d].outputMaxY, profiles.deviceSettings[d].swapAxes, screenWidth, screenHeight, 0, 0, screenWidth, screenHeight, 0); } } else if(profiles.deviceSettings[d].inputDeviceCount > 0) { int o; for(o = 0; o < res->noutput; o++) { XRROutputInfo *outpInf = XRRGetOutputInfo(display, res, res->outputs[o]); if((profiles.deviceSettings[d].autoOutput && (strstr(outpInf->name, "LVDS") || strstr(outpInf->name, "lvds")) ) || (profiles.deviceSettings[d].attachedOutput && !strcmp(outpInf->name, profiles.deviceSettings[d].attachedOutput))) { /* This is the attached output */ if(outpInf->crtc != 0) { /* The output is active (has a CRTC) */ XRRCrtcInfo* crtcInf = XRRGetCrtcInfo(display, res, outpInf->crtc); if(debugMode) { printf("Output %s -- x: %i; y: %i; w: %i; h: %i\n", outpInf->name, crtcInf->x, crtcInf->y, crtcInf->width, crtcInf->height); } /* Set calibration */ int id = 0; for(id = 0; id<profiles.deviceSettings[d].inputDeviceCount; id++) { if(debugMode) { printf("Calibrate Device with ID %i\n", profiles.deviceSettings[d].inputDeviceIDs[id]); } setCalibration(profiles.deviceSettings[d].inputDeviceIDs[id], profiles.deviceSettings[d].outputMinX, profiles.deviceSettings[d].outputMaxX, profiles.deviceSettings[d].outputMinY, profiles.deviceSettings[d].outputMaxY, profiles.deviceSettings[d].swapAxes, screenWidth, screenHeight, crtcInf->x, crtcInf->y, crtcInf->width, crtcInf->height, crtcInf->rotation); } XRRFreeCrtcInfo(crtcInf); } /* Output found, so break */ break; } XRRFreeOutputInfo(outpInf); } } } XRRFreeScreenResources(res); }
uint_least8_t ADS7846::doCalibration(MI0283QT9 *lcd, uint16_t eeprom_addr, uint_least8_t check_eeprom) //touch panel calibration routine { uint_least8_t i; CAL_POINT lcd_points[3] = {CAL_POINT1, CAL_POINT2, CAL_POINT3}; //calibration point postions CAL_POINT tp_points[3]; //calibration data in EEPROM? if(readCalibration(eeprom_addr) && check_eeprom) { return 0; } //clear screen and wait for touch release lcd->fillScreen(RGB(255,255,255)); #if defined(__AVR__) lcd->drawTextPGM((lcd->getWidth()/2)-50, (lcd->getHeight()/2)-10, PSTR("Calibration"), RGB(0,0,0), RGB(255,255,255), 1); #else lcd->drawText((lcd->getWidth()/2)-50, (lcd->getHeight()/2)-10, "Calibration", RGB(0,0,0), RGB(255,255,255), 1); #endif while(getPressure() > MIN_PRESSURE){ service(); }; //show calibration points for(i=0; i<3; ) { //draw points lcd->drawCircle(lcd_points[i].x, lcd_points[i].y, 2, RGB( 0, 0, 0)); lcd->drawCircle(lcd_points[i].x, lcd_points[i].y, 5, RGB( 0, 0, 0)); lcd->drawCircle(lcd_points[i].x, lcd_points[i].y, 10, RGB(255, 0, 0)); //run service routine service(); //press dectected? -> save point if(getPressure() > MIN_PRESSURE) { lcd->fillCircle(lcd_points[i].x, lcd_points[i].y, 2, RGB(255,0,0)); tp_points[i].x = getXraw(); tp_points[i].y = getYraw(); i++; //wait and redraw screen delay(100); lcd->fillScreen(RGB(255,255,255)); #if defined(__AVR__) lcd->drawTextPGM((lcd->getWidth()/2)-50, (lcd->getHeight()/2)-10, PSTR("Calibration"), RGB(0,0,0), RGB(255,255,255), 1); #else lcd->drawText((lcd->getWidth()/2)-50, (lcd->getHeight()/2)-10, "Calibration", RGB(0,0,0), RGB(255,255,255), 1); #endif } } //calulate calibration matrix setCalibration(lcd_points, tp_points); //save calibration matrix writeCalibration(eeprom_addr); //wait for touch release while(getPressure() > MIN_PRESSURE){ service(); }; return 1; }
// Load from a viewXXXX directory. void RGBDImage :: loadFromDir(const std::string& dir, const RGBDCalibration* calib, RGBDProcessor* processor) { m_directory = dir; if (!is_file(dir+"/raw/color.png") && is_file(dir+"/color.png")) { rawRgbRef() = imread(dir + "/color.png", 1); rawRgb().copyTo(rgbRef()); ntk_ensure(rgbRef().data, ("Could not read color image from " + dir).c_str()); } else { if (is_file(dir + "/raw/color.png")) { rawRgbRef() = imread(dir + "/raw/color.png", 1); ntk_ensure(rawRgbRef().data, ("Could not read raw color image from " + dir).c_str()); } if (is_file(dir + "/raw/depth.raw")) { rawDepthRef() = imread_Mat1f_raw(dir + "/raw/depth.raw"); ntk_ensure(rawDepthRef().data, ("Could not read raw depth image from " + dir).c_str()); } else if (is_file(dir + "/raw/depth.yml")) { rawDepthRef() = imread_yml(dir + "/raw/depth.yml"); ntk_ensure(rawDepthRef().data, ("Could not read raw depth image from " + dir).c_str()); } if (is_file(dir + "/raw/amplitude.raw")) { rawAmplitudeRef() = imread_Mat1f_raw(dir + "/raw/amplitude.raw"); ntk_ensure(rawAmplitudeRef().data, ("Could not read raw amplitude image from " + dir).c_str()); } if (is_file(dir + "/raw/amplitude.yml")) { rawAmplitudeRef() = imread_yml(dir + "/raw/amplitude.yml"); ntk_ensure(rawAmplitudeRef().data, ("Could not read raw amplitude image from " + dir).c_str()); } else if (is_file(dir + "/raw/amplitude.png")) { rawAmplitudeRef() = imread(dir + "/raw/amplitude.png", 0); ntk_ensure(rawAmplitudeRef().data, ("Could not read raw amplitude image from " + dir).c_str()); } if (is_file(dir + "/raw/intensity.raw")) { rawIntensityRef() = imread_Mat1f_raw(dir + "/raw/intensity.raw"); ntk_ensure(rawIntensityRef().data, ("Could not read raw intensity image from " + dir).c_str()); } else if (is_file(dir + "/raw/intensity.yml")) { rawIntensityRef() = imread_yml(dir + "/raw/intensity.yml"); ntk_ensure(rawIntensityRef().data, ("Could not read raw intensity image from " + dir).c_str()); } else if (is_file(dir + "/raw/intensity.png")) { rawIntensityRef() = imread(dir + "/raw/intensity.png", 0); ntk_ensure(rawIntensityRef().data, ("Could not read raw intensity image from " + dir).c_str()); } } setCalibration(calib); if (processor) processor->processImage(*this); }
PoseICP( pcl::PointCloud<pcl::PointXYZRGBA>::Ptr &pc1, pcl::PointCloud<pcl::PointXYZRGBA>::Ptr &pc2, Eigen::Matrix3d &Calib ) { setCalibration( Calib ); setClouds( pc1, pc2 ); load_images = false; }
PoseICP( std::string &rgb1, std::string &range1, std::string &rgb2, std::string &range2, Eigen::Matrix3d &Calib ) { setCalibration( Calib ); setImages( rgb1, range1, rgb2, range2 ); load_clouds = false; };
PoseICP( cv::Mat *rgb1, cv::Mat *range1, cv::Mat *rgb2, cv::Mat *range2, Eigen::Matrix3d &Calib ) { setCalibration( Calib ); setImages( rgb1, range1, rgb2, range2 ); load_clouds = false; };
PoseICP( Eigen::Matrix3d &Calib ) { setCalibration( Calib ); load_images = false; load_clouds = false; };