void saveDisp::getDisparities(const ug_stereomatcher::foveatedstackConstPtr dispX_msg, const ug_stereomatcher::foveatedstackConstPtr dispY_msg, const ug_stereomatcher::foveatedstackConstPtr dispC_msg)
{
    // Get images
    cv_bridge::CvImagePtr cv_dispPtrH, cv_dispPtrV, cv_dispPtrC;

    ROS_INFO_STREAM("Rows: " << dispX_msg->im_height << " Cols: " << dispX_msg->im_width);
    ROS_INFO_STREAM("Rows: " << dispY_msg->im_height << " Cols: " << dispY_msg->im_width);
    ROS_INFO_STREAM("Rows: " << dispC_msg->im_height << " Cols: " << dispC_msg->im_width);

    ROS_INFO("Processing images...");
    try
    {
        cv_dispPtrH = cv_bridge::toCvCopy(dispX_msg->image_stack, enc::TYPE_32FC1);
        cv_dispPtrV = cv_bridge::toCvCopy(dispY_msg->image_stack, enc::TYPE_32FC1);
        cv_dispPtrC = cv_bridge::toCvCopy(dispC_msg->image_stack, enc::TYPE_32FC1);
    }
    catch (cv_bridge::Exception& e)
    {
        ROS_ERROR("Could not convert disparities to 'TYPE_32FC1'");
        return;
    }

saveImages("_FC.tif", cv_dispPtrC->image,1);
saveImages("_FH.tif", cv_dispPtrH->image,1);
saveImages("_FV.tif", cv_dispPtrV->image,1);
}
Exemplo n.º 2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    centralW = new QWidget;
    orignW = new QWidget;
    transW = new QWidget;
    qDebug("original");
    original = new Image(orignW, this);
    qDebug("transformed");
    transformed = new Image(transW, this);
    imageLayout = new QHBoxLayout;
    imageLayout->addWidget(orignW);
    imageLayout->addWidget(transW);
    centralW->setLayout(imageLayout);

    setCentralWidget(centralW);

    createActions();
    createMenus();

    setWindowTitle(tr("Transformation"));
    resize(1350, 700);

    connect(this, SIGNAL(saveImages(QString)), transformed, SLOT(saveImage(QString)));
}
Exemplo n.º 3
0
int main() {
	loadImages();
	initData();
	initResults();
	cross2DConv();
	saveImages();
	freeMem();

  return 0;
}
FuseProb::FuseProb(vector<Mat> P, vector<Mat> T, Mat& M, int o, string path)
{
	cout<<"Insite the FuseProb class"<<endl;
	m_rows = M.rows; m_cols = M.cols; 
	m_type = M.type(); m_size = M.size();
	orient = o;
	cout<<"rows cols type "<<m_rows<<" "<<m_cols<<endl;
	readProbTime(P, T);
//	normalizeProbs(); //This is wrong and hence commented... normalization should happen across the 8 orientations
	multProbTime();
	saveImages(path);
}
Exemplo n.º 5
0
//--------------------------------------------------------------
void testApp::keyReleased(int key){
    switch (key) {
        case ' ':
            captureFrame();
            break;
        case 's':
            cout <<"start saving\n" << endl;
            gifEncoder.save("gifs/"+ofGetTimestampString()+".gif");
            saveImages();
            gifEncoder.reset();
            
            break;
        default:
            break;
			
		//case 'p':
			
			//break;

			
    }
}
Exemplo n.º 6
0
void MainWindow::saveTransfImg()
{
    QString str_matrix = original->showMatrix();
    str_matrix.replace(QRegExp("[^\\w]+"), "_");
    emit saveImages(imgfilename+str_matrix);
}
Exemplo n.º 7
0
void ImageViewer::contextMenuEvent(QContextMenuEvent *event) {
  if (!m_flipbook) return;

  QAction *action;

  if (m_isColorModel) {
    event->ignore();
    return;
  }

  QMenu *menu = new QMenu(this);

  if (m_flipbook->getPreviewedFx()) {
    if (!(windowState() & Qt::WindowFullScreen)) {
      action = menu->addAction(tr("Clone Preview"));
      action->setShortcut(QKeySequence(
          CommandManager::instance()->getKeyFromId(MI_ClonePreview)));
      connect(action, SIGNAL(triggered()), m_flipbook, SLOT(clonePreview()));
    }

    if (m_flipbook->isFreezed()) {
      action = menu->addAction(tr("Unfreeze Preview"));
      action->setShortcut(QKeySequence(
          CommandManager::instance()->getKeyFromId(MI_FreezePreview)));
      connect(action, SIGNAL(triggered()), m_flipbook, SLOT(unfreezePreview()));
    } else {
      action = menu->addAction(tr("Freeze Preview"));
      action->setShortcut(QKeySequence(
          CommandManager::instance()->getKeyFromId(MI_FreezePreview)));
      connect(action, SIGNAL(triggered()), m_flipbook, SLOT(freezePreview()));
    }

    action = menu->addAction(tr("Regenerate Preview"));
    action->setShortcut(QKeySequence(
        CommandManager::instance()->getKeyFromId(MI_RegeneratePreview)));
    connect(action, SIGNAL(triggered()), m_flipbook, SLOT(regenerate()));

    action = menu->addAction(tr("Regenerate Frame Preview"));
    action->setShortcut(QKeySequence(
        CommandManager::instance()->getKeyFromId(MI_RegenerateFramePr)));
    connect(action, SIGNAL(triggered()), m_flipbook, SLOT(regenerateFrame()));

    menu->addSeparator();
  }

  action = menu->addAction(tr("Load / Append Images"));
  connect(action, SIGNAL(triggered()), m_flipbook, SLOT(loadImages()));

  // history of the loaded paths of flipbook
  action = CommandManager::instance()->getAction(MI_LoadRecentImage);
  menu->addAction(action);
  action->setParent(m_flipbook);

  if (m_flipbook->isSavable()) {
    action = menu->addAction(tr("Save Images"));
    connect(action, SIGNAL(triggered()), m_flipbook, SLOT(saveImages()));
  }
  menu->addSeparator();

  QAction *reset = menu->addAction(tr("Reset View"));
  reset->setShortcut(
      QKeySequence(CommandManager::instance()->getKeyFromId(V_ZoomReset)));
  connect(reset, SIGNAL(triggered()), SLOT(resetView()));

  QAction *fit = menu->addAction(tr("Fit To Window"));
  fit->setShortcut(
      QKeySequence(CommandManager::instance()->getKeyFromId(V_ZoomFit)));
  connect(fit, SIGNAL(triggered()), SLOT(fitView()));

#ifdef _WIN32

  if (ImageUtils::FullScreenWidget *fsWidget =
          dynamic_cast<ImageUtils::FullScreenWidget *>(parentWidget())) {
    bool isFullScreen = (fsWidget->windowState() & Qt::WindowFullScreen) != 0;

    action = menu->addAction(isFullScreen ? tr("Exit Full Screen Mode")
                                          : tr("Full Screen Mode"));

    action->setShortcut(QKeySequence(
        CommandManager::instance()->getKeyFromId(V_ShowHideFullScreen)));
    connect(action, SIGNAL(triggered()), fsWidget, SLOT(toggleFullScreen()));
  }

#endif

  bool addedSep = false;

  if (m_isHistogramEnable &&
      visibleRegion().contains(event->pos() * getDevPixRatio())) {
    menu->addSeparator();
    addedSep = true;
    action   = menu->addAction(tr("Show Histogram"));
    connect(action, SIGNAL(triggered()), SLOT(showHistogram()));
  }

  if (m_visualSettings.m_doCompare) {
    if (!addedSep) menu->addSeparator();
    action = menu->addAction(tr("Swap Compared Images"));
    connect(action, SIGNAL(triggered()), SLOT(swapCompared()));
  }

  menu->exec(event->globalPos());

  action = CommandManager::instance()->getAction(MI_LoadRecentImage);
  action->setParent(0);

  delete menu;
  update();
}
 bool MeasurementFunctorGoldImage::callOnClear()
 {
   bool goldFunctionSucceeded = saveImages();
   bool testSucceeded = MeasurementFunctor::callOnClear();
   return( goldFunctionSucceeded && testSucceeded );
 }
Exemplo n.º 9
0
LapUSMainWindow::LapUSMainWindow(mtsIntuitiveDaVinci *daVinci,svlFilterImageOpenGLQtWidget *USVideoWidget,svlFilterImageFileWriter &USimagewriter1,svlFilterImageFileWriter &Liveimagewriter1,string saveFolderPath)
{
	clicked = false ;
	released = false;
//	int argc = 0;
//	char **argv;
//	QApplication app(argc, argv);
	this->daVinci = daVinci;
	this->saveFolderPath = saveFolderPath;
	this->setWindowState(Qt::WindowFullScreen);
	setMouseTracking(true);
	count = 1;
	USimagewriter = &USimagewriter1;
	Liveimagewriter = &Liveimagewriter1;
	std::cout<<"Creating the main window......\n";
	/* -------------Create the browser tabs -----------------*/
	browserWidget = new BrowserWidget(this);

	/*--------------Create the US + Real Image Viewer-------*/
	USviewerWidget = new USViewer(this);

	/*-------------Create the preop image viewer -------*/
	preopViewerWidget = new PreopViewer(this);

	/* Create the LapUS mouse */
//	mouse = new LapUSMouse(daVinci); 

    //this->setStyleSheet("background-color:black;");


	/*-------------- Create the video widget ------------------*/

	QHBoxLayout* videoLayout = new QHBoxLayout();//(QBoxLayout::LeftToRight);
	videoLayout->setMargin(0);
	videoLayout->setSpacing(0);
	//videoLayout->addWidget(USVideoWidget,4,Qt::AlignCenter);
	videoLayout->addWidget(USVideoWidget,4);
	//USVideoWidget->setFixedSzie(400,400);

	// contains the video and the save button
	videoWidget = new QWidget();
	videoWidget->setParent(this);
//	videoWidget->setFixedSize(380,380);
	//videoWidget->setFixedSize(400,380);

	//QPushButton * Save = new QPushButton();
	Save = new QPushButton();
	Save->setFixedSize(120,50);
	Save->setText("Save");
	connect(Save,SIGNAL(clicked()),this,SLOT(saveImages()));
	Save->setStyleSheet("QPushButton { background-color:gray; font-size: 14pt}");//" qlineargradientx1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #f6f7fa, stop: 1 #dadbde}");
 
	videoWidget->setLayout(videoLayout);

	justWidget = new QWidget();
	//QVBoxLayout* ll = new QVBoxLayout();
	QHBoxLayout* ll = new QHBoxLayout();
	ll->addWidget(videoWidget);
	ll->addWidget(Save,0,Qt::AlignRight | Qt::AlignVCenter);
	justWidget->setLayout(ll);
	ll->setMargin(0);
	ll->setSpacing(0);


	// QWidget* justWidget = new QWidget();
	// QVBoxLayout* ll = new QVBoxLayout();
	// ll->addWidget(videoWidget);
	// ll->addWidget(Save,0,Qt::AlignBottom | Qt::AlignHCenter);
	// justWidget->setLayout(ll);

	//	videoWidget->show();
	//videoWidget->setMinimumSize(400,400);
	//videoWidget->setGeometry(0,0,350,350);
	//videoWidget->setFixedSize(350,350);  // TODO set it up according to the screen size 
	/*-------------- Create a the left widget containing the video , USViewer and preop ------------------*/


	QDesktopWidget *desk = QApplication::desktop();
//	QRect screenSize;
	if(desk)
     	screenSize = desk->screenGeometry(0);

    std::cout<<"Printing the screen geometry x :";
    std::cout<<screenSize.x() <<"y : "<<screenSize.y();
    std::cout<<"\n";

//	USviewerWidget->hide();
	preopViewerWidget->hide();
	//videoWidget->show();
	//videoWidget->setFixedSize(400,400);


	// QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
	// sizePolicy.setHeightForWidth(true);
	// videoWidget->setSizePolicy(sizePolicy);

	/* add the video widget , USviewer and the preopview in a layout*/
    // QGridLayout *leftLayout = new QGridLayout();
    // leftLayout->addWidget(videoWidget,0,0);
    // leftLayout->addWidget(USviewerWidget,1,0);
    // leftLayout->addWidget(preopViewerWidget,1,0);
    
    //QVBoxLayout *leftLayout = new QVBoxLayout();
    //leftLayout->addWidget(videoWidget,1,Qt::AlignTop);
	//leftLayout->addWidget(USviewerWidget,1);
   // leftLayout->addWidget(preopViewerWidget,1);



    
    QWidget* viewerWidget = new QWidget(this);
    QVBoxLayout *viewerLayout = new QVBoxLayout();
    viewerLayout->addWidget(USviewerWidget);
    viewerLayout->addWidget(preopViewerWidget);
    viewerLayout->setSpacing(0);
	viewerLayout->setMargin(0);


    viewerWidget->setLayout(viewerLayout);
    
	QWidget* leftWidget = new QWidget();
    //QHBoxLayout* leftLayout = new QHBoxLayout();
    QVBoxLayout* leftLayout = new QVBoxLayout();
//    leftLayout->addWidget(videoWidget,1);
    leftLayout->addWidget(justWidget,2);
    leftLayout->addWidget(viewerWidget,1);
    leftLayout->setSpacing(0);
    leftLayout->setMargin(0);

    leftWidget->setLayout(leftLayout);

    leftWidget->setFixedSize(((screenSize.width()*3/4)-10),screenSize.height());
	videoWidget->setFixedSize(screenSize.height()*5/8*4/3,screenSize.height()*5/8);


	//USviewerWidget->hide();
	/*-------------------- Add the top widget and the browser widget to the mainlayout-----------------------*/
    //QGridLayout *mainLayout = new QGridLayout();
    QHBoxLayout* mainLayout = new QHBoxLayout();
//    mainLayout->addWidget(topWidget,0,Qt::AlignTop);
//    mainLayout->addWidget(leftWidget,0,Qt::AlignLeft);

    mainLayout->addWidget(leftWidget,7,Qt::AlignLeft);
    //mainLayout->setSpacing(0);
    //mainLayout->addWidget(browserWidget,0,Qt::AlignBottom);
    mainLayout->addWidget(browserWidget,0,Qt::AlignRight);
    //mainLayout->addWidget(rightWidget,2,Qt::AlignRight);
    //this->setLayout(layout);
    // viewerWidget->setLayout(layout);
    this->setLayout(mainLayout);
	this->show();

	USviewerWidget->setStyleSheet("background-color:black;");
    leftWidget->setStyleSheet("background-color:black;");
   // this->setStyleSheet("background-color:black;");


	/* Create new lap US mouse */
	mouse = new LapUSMouse(daVinci,this);
//	mouse->show();	

	connect(mouse,SIGNAL(pinched(int ,int) ),this,SLOT(mouseClicked(int,int)));
	connect(mouse,SIGNAL(moved(int ,int) ),this,SLOT(mouseMoved(int,int)));
	connect(mouse,SIGNAL(released()),this,SLOT(mouseReleased()));

	connect(browserWidget,SIGNAL(updateUSImage(QListWidgetItem*)),this,SLOT(showItem(QListWidgetItem*)));
	connect(browserWidget,SIGNAL(updatePreopImage(QListWidgetItem*)),this,SLOT(showItemPreop(QListWidgetItem*)));
//	app.exec();

	//connect(callbacks, pinched())
	//this->resize(600,500);
}