skeletonVisualization::skeletonVisualization(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { ui.setupUi(this); ui.centralWidget->setContentsMargins(6, 6, 6, 6); ui.centralWidget->setLayout(ui.horizontalLayout); connect(ui.buttonOpen, SIGNAL(clicked()), this, SLOT(openImage())); connect(ui.actionOpen, SIGNAL(activated()), this, SLOT(openImage())); connect(ui.buttonRefresh, SIGNAL(clicked()), this, SLOT(updateSkeleton())); connect(ui.actionRefresh, SIGNAL(activated()), this, SLOT(updateSkeleton())); connect(ui.buttonSave, SIGNAL(clicked()), this, SLOT(saveImage())); connect(ui.actionSave, SIGNAL(activated()), this, SLOT(saveImage())); connect(ui.buttonConnect, SIGNAL(clicked()), this, SLOT(breaksConnector())); connect(ui.actionConnect, SIGNAL(activated()), this, SLOT(breaksConnector())); connect(ui.buttonQuit, SIGNAL(clicked()), this, SLOT(exitMethod())); connect(ui.actionQuit, SIGNAL(activated()), this, SLOT(exitMethod())); connect(ui.sliderScale, SIGNAL(valueChanged(int)), this, SLOT(setScaleValue(int))); connect(ui.checkBoxCircles, SIGNAL(stateChanged(int)), this, SLOT(checkBoxesChanged(int))); connect(ui.checkBoxBones, SIGNAL(stateChanged(int)), this, SLOT(checkBoxesChanged(int))); connect(ui.checkBoxContours, SIGNAL(stateChanged(int)), this, SLOT(checkBoxesChanged(int))); connect(ui.checkBoxImage, SIGNAL(stateChanged(int)), this, SLOT(checkBoxesChanged(int))); connect(ui.actionOn, SIGNAL(activated()), this, SLOT(scaleOn())); connect(ui.actionOff, SIGNAL(activated()), this, SLOT(scaleOff())); connect(ui.actionOriginal, SIGNAL(activated()), this, SLOT(scaleOrig())); connect(ui.actionInternal, SIGNAL(activated()), this, SLOT(internal())); connect(ui.actionExternal, SIGNAL(activated()), this, SLOT(external())); scene = 0; drawCircles = ready = 0; drawBones = drawImage = drawContours = skeletonView = 1; scale = 1.0; }
void MainWindow::deleteFileSlot() { //ask if user really wants to delete the file int result = QMessageBox::question(this, tr("Delete"), tr("Do you want to delete %1?").arg(fileUtils->getFileName()), QMessageBox::Yes | QMessageBox::No); if (result == QMessageBox::No) { return; } if (fileUtils->deleteFile()) { qDebug() << tr("File deleted"); } else { QMessageBox::information(this, tr("EyeSight"), tr("The file couldn't be deleted"), QMessageBox::Ok); } if (fileUtils->getFilesAmount() != 0) { //removes the file from the list of recent files, and since it was the last one //opened, then remove the first in the list. recentFilesPath.removeAt(0); createRFActs(); openImage(); } else { imageWidget->clear(); } }
PidMain::PidMain(QWidget *parent) : QMainWindow(parent) { setupUi(this); // Connect signals // File connect(menuOpenImage, SIGNAL( triggered() ), this, SLOT( openImage() )); connect(menuSaveCurrent, SIGNAL( triggered() ), this, SLOT( saveCurrentAs() )); // Image connect(menuGenerateGrayScale, SIGNAL( triggered() ), this, SLOT( generateGrayScale() )); connect(menuGenerateHistogram, SIGNAL( triggered() ), this, SLOT( generateHistogram() )); // Help connect(menuOpenAbout, SIGNAL( triggered() ), this, SLOT( openAboutDialog() )); connect(menuOpenHelp, SIGNAL( triggered() ), this, SLOT( openHelpDialog() )); // Filters connect(menuFiltersAltaIdeal, SIGNAL( triggered() ), this, SLOT( openPassaAltaIdeal() )); connect(menuFiltersBaixaIdeal, SIGNAL( triggered() ), this, SLOT( openPassaBaixaIdeal() )); connect(menuFiltersIdeal, SIGNAL( triggered() ), this, SLOT( openIdeal() )); connect(menuButterworthBaixa, SIGNAL( triggered() ), this, SLOT( openButterworthBaixa() )); connect(menuButterworthAlta, SIGNAL( triggered() ), this, SLOT( openButterworthAlta() )); // initializing some widgets mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); }
/** * Activates all action buttons. */ void FotoLab::activateActions() { connect(ui.actionClose, SIGNAL(triggered()), qApp, SLOT(quit())); connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(openImage())); connect(ui.actionReload, SIGNAL(triggered()), this, SLOT(reloadImageData())); connect(ui.actionSaveAs, SIGNAL(triggered()), this, SLOT(saveImage())); connect(ui.actionAreaColor, SIGNAL(triggered()), this, SLOT(showColorDialog())); connect(ui.actionFillArea, SIGNAL(triggered()), ui.graphicsView, SLOT(fillArea())); connect(ui.actionCut, SIGNAL(triggered()), this, SLOT(cutArea())); connect(ui.actionEdges, SIGNAL(triggered()), this, SLOT(proposeEdges())); connect(ui.actionLines, SIGNAL(triggered()), this, SLOT(proposeLines())); connect(ui.actionDrawArea, SIGNAL(triggered()), ui.graphicsView, SLOT(switchDrawing())); // connect(ui.actionProcess, SIGNAL(triggered()), ui.graphicsView, SLOT(processErase())); connect(ui.actionProcess, SIGNAL(triggered()), ui.graphicsView, SLOT(processShowEdges())); connect(ui.actionProperties, SIGNAL(triggered()), this, SLOT(showProperties())); connect(ui.actionHelpAbout, SIGNAL(triggered()), this, SLOT(showHelpAbout())); // processShowEdges connect(ui.actionZoomIn, SIGNAL(triggered()), ui.graphicsView, SLOT(zoomIn())); connect(ui.actionZoomOut, SIGNAL(triggered()), ui.graphicsView, SLOT(zoomOut())); connect(ui.actionZoomNormal, SIGNAL(triggered()), ui.graphicsView, SLOT(zoomNormal())); connect(ui.actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(&tlowSpin, SIGNAL(valueChanged(double)), this, SLOT(validateLowTreshold(double))); connect(&thighSpin, SIGNAL(valueChanged(double)), this, SLOT(validateHighTreshold(double))); }
/* * reload if file was changed */ void MainWindow::slotfileChanged(const QString &fileName) { if (!modified) { this->statusBar()->showMessage( tr("Source image was modified! Reloading..."), 4000); openImage(fileName); } }
/** Called for: double click, return, Open */ void BaseTreeView::slotSelectFile(QListViewItem *item) { KFileTreeViewItem* kftvi = currentKFileTreeViewItem(); if (!kftvi || kftvi->isDir()) return; KURL urlToOpen = kftvi->url(); if (!urlToOpen.isEmpty()) { if ( QuantaCommon::checkMimeGroup(urlToOpen,"text") ) { emit openFile(urlToOpen); item->repaint(); } else if ( QuantaCommon::checkMimeGroup(urlToOpen, "image") ) //it may be an image { emit openImage( urlToOpen); } else if ( expandArchiv(kftvi)) //it may be an archiv { } else //it is an unknown type, maybe binary { if (QuantaCommon::denyBinaryInsert(this) == KMessageBox::Yes) { emit openFile(urlToOpen); item->repaint(); } } } }
Texture2D* openDotaImage(const char* jpgFile) { // 目前Android和IOS平台处理jpg+mask还有点问题,故暂时屏蔽相关平台的处理代码 if (nullptr == jpgFile || '\0' == *jpgFile) return nullptr; #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) std::string basePath = "", fileName = jpgFile; size_t pos = fileName.find_last_of("."); if (pos != std::string::npos) fileName = fileName.substr(0, pos); pos = fileName.find_last_of("/"); if (pos != std::string::npos) { basePath = fileName.substr(0, pos+1); fileName = fileName.substr(pos+1); } std::string maskFile = basePath + fileName + "_alpha_mask"; if (FileUtils::getInstance()->isFileExist(maskFile)) return openImage(jpgFile, maskFile.c_str()); else return Director::getInstance()->getTextureCache()->addImage(jpgFile); #else return Director::getInstance()->getTextureCache()->addImage(jpgFile); #endif }
void convert(const Common::UString &inFile, const Common::UString &outFile, Aurora::FileType type, bool flip) { Common::ReadFile in(inFile); if (type == Aurora::kFileTypeNone) { // Detect by file contents type = detectType(in); if (type == Aurora::kFileTypeNone) { // Detect by file name type = detectType(inFile); if (type == Aurora::kFileTypeNone) throw Common::Exception("Failed to detect type of file \"%s\"", inFile.c_str()); } } Images::Decoder *image = openImage(in, type); if (flip) image->flipVertically(); try { image->dumpTGA(outFile); } catch (...) { delete image; throw; } delete image; }
void OmniFEMMainFrame::createTopToolBar() { wxStandardPaths path = wxStandardPaths::Get(); wxImage::AddHandler(new wxPNGHandler); std::string resourcesDirectory = path.GetAppDocumentsDir().ToStdString() + std::string("/GitHub/Omni-FEM/src/UI/MainFrame/resources/");// equilivant to ~ in command line. This is for the path for the source code of the resources mainFrameToolBar->Create(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_TOP | wxNO_BORDER); /* This section will need to load the images into memory */ wxImage saveImage(resourcesDirectory + "save.png", wxBITMAP_TYPE_PNG); wxImage openImage(resourcesDirectory + "Open.png", wxBITMAP_TYPE_PNG); wxImage newFileImage(resourcesDirectory + "new_file.png", wxBITMAP_TYPE_PNG); /* This section will convert the images into bitmaps */ wxBitmap saveBitmap(saveImage); wxBitmap openImageBitmap(openImage); wxBitmap newFileBitmap(newFileImage); /* This section will add the tool to the toolbar */ mainFrameToolBar->AddTool(toolbarID::ID_ToolBarNew, newFileBitmap, "New File"); mainFrameToolBar->AddTool(toolbarID::ID_ToolBarOpen, openImageBitmap, "Open"); mainFrameToolBar->AddTool(toolbarID::ID_ToolBarSave, saveBitmap, "Save"); /* Enable the tooolbar and associate it with the main frame */ mainFrameToolBar->Realize(); this->SetToolBar(mainFrameToolBar); }
void EditorWindow::createActions() { openAct = new QAction(tr("&Open"), this); openAct->setShortcut(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(openImage())); saveAct = new QAction(tr("&Save"), this); saveAct->setShortcut(QKeySequence::Save); connect(saveAct, SIGNAL(triggered()), this, SLOT(saveImage())); saveAsAct = new QAction(tr("Save As"), this); saveAsAct->setShortcut(QKeySequence::SaveAs); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveImageAs())); quitAct = new QAction(tr("Quit"), this); quitAct->setShortcut(QKeySequence::Quit); connect(quitAct, SIGNAL(triggered()), this, SLOT(close())); zoomInAct = new QAction(tr("Zoom In"), this); zoomInAct->setShortcut(QKeySequence::ZoomIn); connect(zoomInAct, SIGNAL(triggered()), imageWidget, SLOT(zoomIn())); zoomOutAct = new QAction(tr("Zoom Out"), this); zoomOutAct->setShortcut(QKeySequence::ZoomOut); connect(zoomOutAct, SIGNAL(triggered()), imageWidget, SLOT(zoomOut())); connect(imageWidget, SIGNAL(zoomOutAvailableChanged(bool)), zoomOutAct, SLOT(setEnabled(bool))); zoomOriginalAct = new QAction(tr("Actual Size"), this); connect(zoomOriginalAct, SIGNAL(triggered()), imageWidget, SLOT(zoomOriginal())); zoomByWheelAct = new QAction(tr("Zoom by Mouse Wheel"), this); zoomByWheelAct->setCheckable(true); zoomByWheelAct->setChecked(false); connect(zoomByWheelAct, SIGNAL(toggled(bool)), imageWidget, SLOT(setWheelZoom(bool))); autoContrastAct = new QAction(tr("Auto Contrast"), this); autoContrastAct->setToolTip(tr("Apply luminance histogram stretching")); connect(autoContrastAct, SIGNAL(triggered()), this, SLOT(doAutoContrast())); autoLevelsAct = new QAction(tr("Auto Levels"), this); autoLevelsAct->setToolTip(tr("Apply channel-wise RGB histogram stretching")); connect(autoLevelsAct, SIGNAL(triggered()), this, SLOT(doAutoLevels())); whiteBalanceAct = new QAction(tr("Correct White Balance"), this); whiteBalanceAct->setToolTip(tr("Apply white balance correction using greyworld model")); connect(whiteBalanceAct, SIGNAL(triggered()), this, SLOT(doWhiteBalance())); geometryAct = new QAction(tr("Scale/Rotate"), this); geometryAct->setToolTip(tr("Scale and rotate image relative to the center")); connect(geometryAct, SIGNAL(triggered()), this, SLOT(doGeometryTransform())); filterAct = new QAction(tr("Filters && Effects"), this); filterAct->setToolTip(tr("Open filtration dialog")); connect(filterAct, SIGNAL(triggered()), this, SLOT(doFilter())); convolutionAct = new QAction(tr("Convolution"), this); convolutionAct->setToolTip(tr("Apply convolution with arbitrary kernel")); connect(convolutionAct, SIGNAL(triggered()), this, SLOT(doConvolution())); }
/** * Constructor of JPG Image Class. * * @param filename: The name of the file. */ JPGImage::JPGImage(string filename){ openImage(filename); setGrayScaleAvaliable(false); setBlackAndWhiteAvaliable(false); setBitsPerPixel(8); }
// Mouse click events bool CcgView::eventFilter(QObject *obj, QEvent *event) { if(obj == ui->graphicsView && event->type() == QEvent::MouseButtonPress) { openImage(); } return false; }
void MainWindow::on_actionOpen_triggered() { QString imageFilename = QFileDialog::getOpenFileName(this, "Open File", "."); if (imageFilename.length() > 0) { newModel(); openImage(imageFilename); } }
void MainWindow::chooseImage() { QString fileName = QFileDialog::getOpenFileName(this, tr("Choose an image"), currentPath, "*"); if (!fileName.isEmpty()) openImage(fileName); }
void MainWindow::dropEvent(QDropEvent *event) { QList<QUrl> urls = event->mimeData()->urls(); if (urls.count()) { QString filename = urls[0].toLocalFile(); openImage(filename); event->acceptProposedAction(); } }
void MainWindow::on_actionReloadFile_triggered() { qDebug() << "reload"; if (modified) // reload only if file was modified... statusBar()->showMessage(tr("Reloading file....")); openImage(recentFile); statusBar()->showMessage(tr("File reloaded."), 2000); }
/*初始化主窗口*/ MainWindow::MainWindow(QWidget *parent): P(parent) { openCVWindow_=new OpenCVWindowDetail; this->setCentralWidget(new __private::CentralWidget(openCVWindow_)); this->setMinimumSize(512,512); this->resize(600,600); QAction * openImage_=menuBar()->addAction(trUtf8(u8"打开图片")); connect(openImage_,&QAction::triggered,this,[this](bool) {openImage(); }); }
int aimAtSideMostTarget(int side){ int most_blob, i, center, error; int attempts = 0; do{ captureImage(); openImage(SOURCE_FILE_NAME); gaussianSmooth(); isolateRed(); findObjects(); if(numBlobs <= 0) { //printf("Couldn't find any targets =(\n"); return(0); } most_blob = 0; if (side) { for(i = 1; i < numBlobs; i++) { if (blobs[most_blob].rightX < blobs[i].rightX && blobs[i].rightX - blobs[i].leftX > MIN_BLOB_WIDTH) { most_blob = i; } } } else { for(i = 1; i < numBlobs; i++) { if (blobs[most_blob].leftX > blobs[i].leftX && blobs[i].rightX - blobs[i].leftX > MIN_BLOB_WIDTH) { most_blob = i; } } } if(blobs[most_blob].rightX - blobs[most_blob].leftX >= MIN_BLOB_WIDTH) { //printf("Found target:\n"); //printf(" Width: %d\n", blobs[most_blob].rightX-blobs[most_blob].leftX); center = (blobs[most_blob].rightX-blobs[most_blob].leftX)/2 + blobs[most_blob].leftX; //printf(" Center: %d\n", center); error = center - IMAGE_CENTER; if(abs(error) <= MAX_TARGET_ERROR) { break; } aimAtTarget(error); } attempts++; } while (abs(error) > MAX_TARGET_ERROR && attempts < MAX_AIM_ATTEMPTS); return(1); }
ImageReader::ImageReader(std::string filePath) : m_fp(NULL), m_isFileOpened(false), m_isFileParsed(false), m_fileName(""), m_p_imageData(nullptr) { // Read image file openImage(filePath); }
void OpenDialog::itemClicked(const QModelIndex &index) { MediaType::Type type = (MediaType::Type)index.data(OpenDialogModel::Type).toInt(); if (type == MediaType::Image) { QString imageId = index.data(OpenDialogModel::ImageId).toString(); emit openImage(imageId); this->dismiss(); } }
void MainWindow::moveToSlot() { QString newFileName = QFileDialog::getExistingDirectory(this, tr("Move to"), getLastDir()); if (fileUtils->moveFile(newFileName)) { qDebug() << "moved"; recentFilesPath.removeAt(0); createRFActs(); openImage(); } }
bool imageViewer::openImage(QByteArray *ba) { QImage tempImage; QBuffer buffer(ba); buffer.open(QIODevice::ReadOnly); if(tempImage.load(&buffer,NULL)) { return openImage(tempImage.convertToFormat(QImage::Format_ARGB32_Premultiplied)); } validImage=false; return false; }
void MainWindow::on_actionOpenFile_triggered() { QString filetype = "Image files (*.bmp *.png *.jpeg *.jpg *.tif *.tiff);;"; filetype += "Tiff files (*.tif *.tiff);;All files (*.*)"; QString last_path = QFileInfo(recentFile).absolutePath(); QString fileName = QFileDialog::getOpenFileName( this, tr("Select image file..."), last_path, filetype); if (!fileName.isEmpty()) { openImage(fileName); } }
void MainWindow::openImageFromCommandLine(const QStringList d) { //sets the file QFileInfo currentFile; currentFile.setFile(d.at(1)); bool open; int i, j; i = 0; j = nameFilters.size(); open = false; //check if the file format is included in the supported formats //in case it is, open=true, but open=false QString g; while (!open && i < j) { g = nameFilters.at(i); g.remove('*'); g.remove('"'); if (currentFile.absoluteFilePath().indexOf(g) != -1) { open = true; i = j; } i++; } //if open=true, the app explore the folder and open the image if (open && fileUtils->openFile(currentFile.absoluteFilePath())) { openImage(); } //if open=false, show a message else { QMessageBox notOpen; notOpen.setIcon(QMessageBox::Information); notOpen.setText(tr("EyeSight couldn't open the image, what do you want to do?")); notOpen.setStandardButtons(QMessageBox::Ok | QMessageBox::Open); notOpen.setDefaultButton(QMessageBox::Ok); int ret = notOpen.exec(); switch (ret) { case QMessageBox::Ok: break; case QMessageBox::Open: this->open(); break; default: // should never be reached break; } } }
int main(int argc, char *argv[]) { char *input=argv[1]; openImage("stor1.bmp"); stegImage(input); writeImage("stor2.bmp"); return(0); }
void MainWindow::createActions() { // Initializing action to open image. Binding slot to trigger. openImageAct = new QAction("Открыть", this); openImageAct->setShortcuts(QKeySequence::Open); // to use familiar hotkeys openImageAct->setStatusTip("Открыть изображение для проверки на дефекты"); connect(openImageAct, SIGNAL(triggered()), this, SLOT(openImage())); // Initializing action to start image processing. processImageAct = new QAction("Обработать", this); processImageAct->setShortcuts(QKeySequence::Refresh); processImageAct->setStatusTip("Начать обработку изображения для выявления дефектов"); connect(processImageAct, SIGNAL(triggered()), this, SLOT(processImage())); // This action is hidden by default to avoid its calls with no image. processImageAct->setEnabled(false); }
void DataInspectionDialog::updateSubject() { QString sb = ""; if (!individual) { sb = SubjectsTree->currentItem()->text(1); Subject_ID_Text->setText("Subject ID: "+sb); } if (openImage()) displayImage(); else { if (individual) QMessageBox::critical(this,"Error opening data", "Could not open data for subject "+baseName+"."); else QMessageBox::critical(this,"Error opening data", "Could not open data for subject "+sb+"."); } }
bool AflSpriteMapObject::addObject(AflMapObject* pObject) { AflSprite* pImage = openImage(pObject->getImage()); if(!pImage) return false; AflSprite* pSprite = new AflSprite; *pSprite = *pImage; pObject->setAddr(pSprite); //スプライトにデータを設定 setDataToSprite((AflSprite*)pSprite,pObject); addList(pSprite); m_listObject.push_back(*pObject); return true; }
void MainWindow::setupMenus() { QMenu *fileMenu = menuBar()->addMenu(tr("&File")); QAction *openAction = fileMenu->addAction(tr("&Open...")); openAction->setShortcuts(QKeySequence::Open); QAction *exitAction = fileMenu->addAction(tr("E&xit")); exitAction->setShortcuts(QKeySequence::Quit); QMenu *gameMenu = menuBar()->addMenu(tr("&Game")); QAction *restartAction = gameMenu->addAction(tr("&Restart")); connect(openAction, SIGNAL(triggered()), this, SLOT(openImage())); connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(restartAction, SIGNAL(triggered()), this, SLOT(setupPuzzle())); }
void ImageViewer::createActions() { openImageAct = new QAction(tr("&Open image..."), this); openImageAct->setShortcut(tr("Ctrl+I")); connect(openImageAct, SIGNAL(triggered()), this, SLOT(openImage())); openFileAct = new QAction(tr("&Open file..."), this); openFileAct->setShortcut(tr("Ctrl+F")); connect(openFileAct, SIGNAL(triggered()), this, SLOT(openFile())); detectAct = new QAction(tr("&Detect"), this); detectAct->setShortcut(tr("Ctrl+D")); connect(detectAct, SIGNAL(triggered()), this, SLOT(detect())); detectAct->setDisabled(true);; exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcut(tr("Ctrl+Q")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); }