void MainWindow::on_Smooth_Shappen_clicked() { this->setEnabled(false); switch(ui->Smooth_ShappenType->currentIndex()) /*0 均值 *1 中值 *2 K邻域 *3 Roberts *4 Sobel *5 拉普拉斯 */ { case 0: { bool clicked; int size = QInputDialog::getInt(this,"矩阵大小","矩阵边长(3-30):",3,3,30,1,&clicked); if(clicked) { showImage(_Image.MTMtransform(size),ui->ShowImage); } break; } case 1: { bool clicked; int size = QInputDialog::getInt(this,"矩阵大小","矩阵边长(3-30):",3,3,30,1,&clicked); if(clicked) { showImage(_Image.VMFtransform(size),ui->ShowImage); } break; } case 2: { bool clicked1; int size = QInputDialog::getInt(this,"矩阵大小","矩阵边长(3-30):",3,3,30,1,&clicked1); if(clicked1) { bool clicked2; int K = QInputDialog::getInt(this,"K值","K值(1-"+QString::number(size*size) +")", 1,1,size*size,1,&clicked2); if(clicked2) { showImage(_Image.KNNMFtransform(size,K),ui->ShowImage); } } break; } case 3: { bool clicked; int thresholdValue = QInputDialog::getInt(this,"阈值","阈值(0-255):",0,0,255,1,&clicked); if(clicked) { showImage(_Image.RobertsTransform(thresholdValue),ui->ShowImage); } break; } case 4: { showImage(_Image.SobelTransform(),ui->ShowImage); break; } case 5: { showImage(_Image.LaplaceTransform(),ui->ShowImage); break; } default:break; } this->setEnabled(true); }
//% weight=70 help=images/show-frame //% parts="ledmatrix" void showFrame(Image i, int frame) { showImage(i, frame * 5); }
int mainMatch(void) { // Initialise capture device CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY ); if(!capture) error("No Capture"); // Declare Ipoints and other stuff IpPairVec matches; IpVec ipts, ref_ipts; // This is the reference object we wish to find in video frame // Replace the line below with IplImage *img = cvLoadImage("imgs/object.jpg"); // where object.jpg is the planar object to be located in the video IplImage *img = cvLoadImage("imgs/object.jpg"); if (img == NULL) error("Need to load reference image in order to run matching procedure"); CvPoint src_corners[4] = {{0,0}, {img->width,0}, {img->width, img->height}, {0, img->height}}; CvPoint dst_corners[4]; // Extract reference object Ipoints surfDetDes(img, ref_ipts, false, 3, 4, 3, 0.004f); drawIpoints(img, ref_ipts); showImage(img); // Create a window cvNamedWindow("OpenSURF", CV_WINDOW_AUTOSIZE ); // Main capture loop while( true ) { // Grab frame from the capture source img = cvQueryFrame(capture); // Detect and describe interest points in the frame surfDetDes(img, ipts, false, 3, 4, 3, 0.004f); // Fill match vector getMatches(ipts,ref_ipts,matches); // This call finds where the object corners should be in the frame if (translateCorners(matches, src_corners, dst_corners)) { // Draw box around object for(int i = 0; i < 4; i++ ) { CvPoint r1 = dst_corners[i%4]; CvPoint r2 = dst_corners[(i+1)%4]; cvLine( img, cvPoint(r1.x, r1.y), cvPoint(r2.x, r2.y), cvScalar(255,255,255), 3 ); } for (unsigned int i = 0; i < matches.size(); ++i) drawIpoint(img, matches[i].first); } // Draw the FPS figure drawFPS(img); // Display the result cvShowImage("OpenSURF", img); // If ESC key pressed exit loop if( (cvWaitKey(10) & 255) == 27 ) break; } // Release the capture device cvReleaseCapture( &capture ); cvDestroyWindow( "OpenSURF" ); return 0; }
uint8_t Gallery::showNext() { if (_index==_gallery.size()-1) _index=0; else _index++; return showImage(_index); }
//------------------------------------------------------------------------------------------------ void CalibrationWidget::on_comboBox_ansicht_currentIndexChanged(int index) { const QModelIndex i = calibrationWidget->tableView_images->currentIndex(); if (i.isValid()) showImage(i); }
MyApp::MyApp(const string &_winName, const Mat &_image) : MyWindow( _winName, _image ), current_operation(nullptr) { showImage(); }
void MainWindow::update() { if(_running) { //Update run time, if running int run_time_ms = _run_time.elapsed(); // ui->runTimeLabel->setText(QString::number(run_time_ms)); ui->runTimeLabel->setText(QTime(0,0).addMSecs(run_time_ms).toString("mm:ss.zzz")); ui->framesDetectedLabel->setText(QString::number(_frame_count)); } if(_serial_port->isOpen()) { ui->serialStatusLabel->setText("Status: connected"); } else { ui->serialStatusLabel->setText("Status: disconnected"); } //Grab frame from camera if(_video_capture.isOpened()) { //_video_capture. //_video_capture >> _image; //_video_capture.read(_image); long frame_time = _run_time.elapsed(); _frame_count++; //Detect markers if(_using_calibration) { _marker_detector.detect(_image,_markers,_camera_parameters,_marker_size); } else { _marker_detector.detect(_image,_markers); } //Iterate through all detected markers //Set timestamp for(int i=0; i < _markers.size(); i++) { _markers[i].draw(_image,cv::Scalar(0,0,255),2); //Update origin, x-axis, and y-axis coordinates if the marker corresponds to one of those if(_markers[i].id == 0) { _origin[0] = _markers[i].Tvec.ptr<float>(0)[0]; _origin[1] = _markers[i].Tvec.ptr<float>(0)[1]; _origin[2] = _markers[i].Tvec.ptr<float>(0)[2]; _origin_px[0] = _markers[i][0].x; _origin_px[1] = _markers[i][0].y; } else if(_markers[i].id == 1) { _x_axis[0] = _markers[i].Tvec.ptr<float>(0)[0]; _x_axis[1] = _markers[i].Tvec.ptr<float>(0)[1]; _x_axis[2] = _markers[i].Tvec.ptr<float>(0)[2]; _x_axis_px[0] = _markers[i][0].x; _x_axis_px[1] = _markers[i][0].y; } else if(_markers[i].id == 2) { _y_axis[0] = _markers[i].Tvec.ptr<float>(0)[0]; _y_axis[1] = _markers[i].Tvec.ptr<float>(0)[1]; _y_axis[2] = _markers[i].Tvec.ptr<float>(0)[2]; _y_axis_px[0] = _markers[i][0].x; _y_axis_px[1] = _markers[i][0].y; } else { //Convert marker to keytrack marker by calculating X, Y, and Theta KeytrackMarker kmarker = arucoMarkerToKeytrackMarker(_markers[i]); //QTextStream(stdout) << _y_axis[0] << endl; /* QTextStream(stdout) << "ID: " << QString::number(kmarker.id) << "X: " << QString::number(kmarker.x) << "Y: " << QString::number(kmarker.y) << endl;*/ if(_serial_port->isOpen()) { //Send marker over serial QString line; line.append(QString::number(kmarker.id)); line.append(','); line.append(QString::number(kmarker.x,'g',3)); line.append(','); line.append(QString::number(kmarker.y,'g',3)); line.append(','); line.append(QString::number(kmarker.theta,'g',3)); line.append(','); line.append(QString::number(frame_time)); line.append('\n'); sendData(line.toUtf8()); } //Add marker point to trajectory //_marker_trajectories.addMarker(kmarker); //KeytrackMarkerTrajectory trajectory = _marker_trajectories.getTrajectory(kmarker.id); //ui->sentDataTextEdit->setText(QString::number(trajectory.size())); } //QTextStream(stdout) << "Marker " << QString::number(i) << endl; //Draw markers on image } //Show frame from camera showImage(&_image); } }
void KuickShow::slotShowInOtherWindow() { showImage( fileWidget->getCurrentItem( false ), true ); }
void KuickShow::slotShowInSameWindow() { showImage( fileWidget->getCurrentItem( false ), false ); }
//% weight=70 help=images/show-frame //% parts="ledmatrix" void showFrame(Image i, int frame, int interval = 400) { showImage(i, frame * 5, interval); }
void KuickShow::slotSelected( const KFileItem *item ) { showImage( item, !oneWindowAction->isChecked() ); }
//Input Port #0: Buffer_Size = 1, Params_Type = SourceDrainMono_Sensor_stm32comm_Params, Data_Type = SourceDrainMono_Sensor_stm32comm_Data bool DECOFUNC(processMonoDrainData)(void * paramsPtr, void * varsPtr, QVector<void *> drainParams, QVector<void *> drainData) { VisualizationMono_Sensor_stm32comm_Params * params=(VisualizationMono_Sensor_stm32comm_Params *)paramsPtr; VisualizationMono_Sensor_stm32comm_Vars * vars=(VisualizationMono_Sensor_stm32comm_Vars *)varsPtr; QVector<SourceDrainMono_Sensor_stm32comm_Params *> drainparams; copyQVector(drainparams,drainParams); QVector<SourceDrainMono_Sensor_stm32comm_Data *> draindata; copyQVector(draindata,drainData); /*======Please Program below======*/ /* Function: process draindata. */ // vars->comm_label->setText(QString("YAW: %1\nrightodom: %2\nleftodom: %3\nrightspeed: %4\nleftspeed: %5\n"). // arg(draindata.front()->yaw). // arg(draindata.front()->rightodom).arg(draindata.front()->leftodom). // arg(draindata.front()->rightspeed).arg(draindata.front()->leftspeed)); if(draindata.size()==0) { vars->qmap->setText("No Data"); return 0; } /*======Please Program below======*/ /* Function: process draindata. */ int minshiftx = 1, minshifty = 1; int i,j,dx,dy; cv::Point2d p; p.x = ((int) (draindata.front()->x / params->pixelsize)) * params->pixelsize; p.y = ((int) (draindata.front()->y / params->pixelsize)) * params->pixelsize; dx = (p.x-vars->mapzero.x)/params->pixelsize; dy = (p.y-vars->mapzero.y)/params->pixelsize; if ( ! (abs(dx)<=minshiftx && abs(dy)<=minshifty))//ÐèÒªÒƶ¯ { vars->mapzero = p; if (abs(dx)>=vars->map.cols/2 || abs(dy)>=vars->map.rows/2)//Òƶ¯¹ýŽó£¬Ö±œÓÖØÖà { vars->map.setTo(0); } else { cv::Mat M(2,3,CV_32F); M.at<float>(0,0)=1;M.at<float>(0,1)=0;M.at<float>(0,2)=-dx; M.at<float>(1,0)=0;M.at<float>(1,1)=1;M.at<float>(1,2)=dy; cv::warpAffine(vars->map,vars->map,M,vars->map.size()); } } //QtÊÇbgrµÄÑÕÉ« cv::Scalar c_red = CV_RGB(0,0,255); cv::Scalar c_blue = CV_RGB(255,144,30); cv::Scalar c_green = CV_RGB(37,225,132); cv::Scalar c_gold = CV_RGB(1,215,255); cv::Point2d mapp = cv::Point2d(draindata.front()->x,draindata.front()->y); mapp -= vars->mapzero; mapp.x = mapp.x / params->pixelsize + params->mapsize/2; mapp.y = mapp.y / params->pixelsize + params->mapsize/2; circle(vars->map,mapp,2,c_gold,-1); //Ê®Ã×Ò»žöÍøžñ cv::Mat gridmap3(cv::Size(params->mapsize,params->mapsize),CV_8UC3); gridmap3.setTo(0); cv::Mat gridmap1(cv::Size(params->mapsize,params->mapsize),CV_8UC1); gridmap1.setTo(0); int grid = 10.0 / params->pixelsize; for(int i = params->mapsize % grid ; i < params->mapsize ; i+= grid) { cv::line(gridmap3,cv::Point(i,0),cv::Point(i,params->mapsize),c_blue,1); cv::line(gridmap1,cv::Point(i,0),cv::Point(i,params->mapsize),cv::Scalar(255),1); } for(int i = params->mapsize - grid ; i > 0 ; i -= grid) { cv::line(gridmap3,cv::Point(0,i),cv::Point(params->mapsize,i),c_blue,1); cv::line(gridmap1,cv::Point(0,i),cv::Point(params->mapsize,i),cv::Scalar(255),1); } cv::bitwise_not(gridmap1,gridmap1); vars->map.copyTo(gridmap3,gridmap1); cv::circle(gridmap3,cv::Point(params->mapsize/2,params->mapsize/2),1,c_red); //compass gridmap3(cv::Rect(params->mapsize-grid+1,0,grid-1,grid-1)).setTo(0); cv::Point composso = cv::Point(params->mapsize-grid/2,grid/2); cv::circle(gridmap3,composso,grid/2-1,c_green,1,CV_AA); cv::line(gridmap3,composso,cv::Point(composso.x + cos(draindata.front()->theta)*(grid-1)/2-1, composso.y - sin(draindata.front()->theta)*(grid-1)/2-1), c_green,1,CV_AA); //speed + odometry + (x,y) gridmap3(cv::Rect(0,0,2*grid-1,grid-1)).setTo(0); cv::putText(gridmap3,QString("(%1, %2)").arg(draindata.front()->x).arg(draindata.front()->y).toStdString(), cv::Point(0,20),CV_FONT_HERSHEY_SCRIPT_SIMPLEX,0.5,c_red,1,CV_AA); cv::putText(gridmap3,QString("leftspeed: %1 m/s").arg(draindata.front()->theta).toStdString(), cv::Point(0,40),CV_FONT_HERSHEY_SCRIPT_SIMPLEX,0.5,c_red,1,CV_AA); cv::putText(gridmap3,QString("rightspeed: %1 m").arg(draindata.front()->rightodom).toStdString(), cv::Point(0,60),CV_FONT_HERSHEY_SCRIPT_SIMPLEX,0.5,c_red,1,CV_AA); cv::putText(gridmap3,QString("leftodom: %1 m").arg(draindata.front()->leftodom).toStdString(), cv::Point(0,80),CV_FONT_HERSHEY_SCRIPT_SIMPLEX,0.5,c_red,1,CV_AA); cv::putText(gridmap3,QString("angle: %1 deg").arg(draindata.front()->theta).toStdString(), cv::Point(0,100),CV_FONT_HERSHEY_SCRIPT_SIMPLEX,0.5,c_red,1,CV_AA); int timestamp=((draindata.front()->timestamp.hour()*60+draindata.front()->timestamp.minute())*60 +draindata.front()->timestamp.second())*1000+draindata.front()->timestamp.msec(); cv::putText(gridmap3,QString("%1 ms").arg(timestamp).toStdString(), cv::Point(0,120),CV_FONT_HERSHEY_SCRIPT_SIMPLEX,0.5,c_red,1,CV_AA); int showWidth = vars->showheight; cv::Mat showImage (cv::Size(showWidth, vars->showheight),CV_8UC3); cv::resize(gridmap3,showImage,showImage.size()); QImage colorimg=QImage((const uchar*)(showImage.data),showImage.cols,showImage.rows, showImage.cols*showImage.channels(),QImage::Format_RGB888); // QImage colorimg=QImage((const uchar*)(vars->map.data),vars->map.cols,vars->map.rows,QImage::Format_RGB888); vars->qmap->setPixmap(QPixmap::fromImage(colorimg)); return 1; }
bool ImageViewer::loadImage(const QString &filename) { file.setFileName(filename); return showImage(); }
void DisplayWindow::outputImage(Mat img) { img2 = img.clone(); origImg = img.clone(); showImage(img2); }
void MainWindow::on_OpenFile_clicked() { ui->OpenFile->setEnabled(false); QString filePath; // filePath = QFileDialog::getOpenFileName(0,"选择图片", // QString(),"bmp(*.bmp)"); filePath = QFileDialog::getOpenFileName(0,"选择图片", QString(),"bmp(*.bmp);;jpg(*.jpg)"); /*获取文件路径成功*/ if(!filePath.isEmpty()) { _Image.getImage(filePath); /*显示图片*/ showImage(_Image.getData(),ui->ShowImage); /*量化、采样设为可用*/ ui->Quantify->setEnabled(true); ui->Sample->setEnabled(true); /*还原设为可用*/ ui->Refresh->setEnabled(true); /*8位量化设为可用*/ ui->ByteQuantify->setEnabled(true); /*灰度直方图设为可用*/ ui->Histogram->setEnabled(true); /*阈值化设为可用*/ ui->Threshold->setEnabled(true); /*转TXT设为可用*/ ui->ConvertTXT->setEnabled(true); /*点变换设为可用*/ ui->GST->setEnabled(true); /*保存设为可用*/ ui->Save->setEnabled(true); /*几何变换设为可用*/ ui->SpaceTransform->setEnabled(true); /*平滑和锐化设为可用*/ ui->Smooth_Shappen->setEnabled(true); /*卷积设为可用*/ ui->Convolve->setEnabled(true); /*腐蚀设为不可用*/ ui->Etch->setEnabled(true); /*膨胀设为不可用*/ ui->Dilate->setEnabled(true); } /*未获取文件路径*/ else { /*不做任何处理*/ } ui->OpenFile->setEnabled(true); }
void KuickShow::slotShowFullscreen() { showImage( fileWidget->getCurrentItem( false ), false, true ); }
MainWidget::MainWidget( QWidget *parent ) : QSplitter( Qt::Horizontal, parent ) , mpKryptonite( new Kryptonite() ) , mpAmazonDE( new KryptoniteJobCoverAmazonDE( mpKryptonite ) ) , mpDiscogs( new KryptoniteJobCoverDiscogs( mpKryptonite ) ) , mpLayout( new QGridLayout( this ) ) , mpFileSysTree( new QTreeView( this ) ) , mpFileSysModel( new QFileSystemModel( this ) ) , mpLineEdit( new QLineEdit( this ) ) , mpFollowPartyman( new QCheckBox( tr("Follow Partyman"), this ) ) , mpCopyBuffer( new QPushButton( tr("Copy debug buffer to clipboard"), this ) ) , mpImage( new DropImageWidget( this ) ) , mpInfo( new QListWidget( this ) ) , mpSignalMapper( new QSignalMapper( this ) ) , mDataMap() , mCacheMap() , mDebugData() { mpKryptonite->setObjectName( "Downloader"); mpAmazonDE->setObjectName( "Amazon" ); mpDiscogs->setObjectName( "Discogs" ); mpFileSysTree->setObjectName( "FileSysTree" ); mpFileSysModel->setObjectName( "FileSysModel" ); mpLineEdit->setObjectName( "LineInput" ); mpFollowPartyman->setObjectName( "FollowPartyman" ); mpFollowPartyman->setChecked( true ); mpCopyBuffer->setObjectName( "CopyBuffer" ); mpImage->setObjectName( "Image" ); mpInfo->setObjectName( "Info" ); QThread *t = new QThread(); connect( qApp, SIGNAL(aboutToQuit()), t, SLOT(quit()) ); ProxyWidget::setProxy( mpKryptonite->networkAccessManager() ); mpKryptonite->moveToThread( t ); mpAmazonDE->moveToThread( t ); mpDiscogs->moveToThread( t ); t->setObjectName( "DownloadThread" ); t->start(); QWidget *w = 0; mpFileSysTree->setModel( mpFileSysModel ); mpFileSysModel->setRootPath( "/" ); mpFileSysModel->setFilter( QDir::NoDotAndDotDot | QDir::AllDirs ); const QString current( Settings::value( Settings::RubberbandmanRootDirectory ) ); QModelIndex qmi( mpFileSysModel->index( current ) ); if( qmi.isValid() ) { mpFileSysTree->setRootIndex( qmi ); mpFileSysTree->setCurrentIndex( mpFileSysModel->index( current ) ); } mpFileSysTree->header()->hide(); mpFileSysTree->setColumnHidden( 1, true ); mpFileSysTree->setColumnHidden( 2, true ); mpFileSysTree->setColumnHidden( 3, true ); QSplitter *s = new QSplitter( Qt::Vertical, this ); w = new QWidget( this ); QVBoxLayout *v = new QVBoxLayout( w ); v->addWidget( mpFileSysTree ); v->addWidget( mpLineEdit ); QHBoxLayout *h = new QHBoxLayout(); v->addLayout( h ); h->addWidget( mpFollowPartyman ); h->addWidget( mpCopyBuffer ); s->addWidget( w ); w = new QWidget( this ); w->setLayout( mpLayout ); s->addWidget( w ); addWidget( s ); w = new QWidget( this ); v = new QVBoxLayout( w ); v->addWidget( mpImage ); v->addWidget( mpInfo ); addWidget( w ); v->setStretch( 0, 1 ); Satellite *satellite = Satellite::get(); connect( mpImage, SIGNAL(droppedUrl(QUrl)), this, SLOT(saveImage(QUrl)) ); connect( mpCopyBuffer, SIGNAL(clicked()), this, SLOT(debugBufferToClipboard()) ); connect( mpLineEdit, SIGNAL(returnPressed()), this, SLOT(requestFromLine()) ); connect( mpFileSysTree, SIGNAL(clicked(QModelIndex)), this, SLOT(entryClicked(QModelIndex)) ); connect( mpSignalMapper, SIGNAL(mapped(QWidget*)), this, SLOT(saveImage(QWidget*)) ); connect( this, SIGNAL(requestSearch(QString)), mpDiscogs, SLOT(requestList(QString)) ); connect( mpDiscogs, SIGNAL(imageFound(QByteArray,QVariant)), this, SLOT(addThumbnail(QByteArray,QVariant)) ); connect( mpDiscogs, SIGNAL(imageDownloaded(QByteArray,QVariant)), this, SLOT(showImage(QByteArray,QVariant)) ); connect( mpDiscogs, SIGNAL(message(QString,QByteArray)), this, SLOT(message(QString,QByteArray)) ); connect( this, SIGNAL(requestSearch(QString)), mpAmazonDE, SLOT(requestList(QString)) ); connect( mpAmazonDE, SIGNAL(imageFound(QByteArray,QVariant)), this, SLOT(addThumbnail(QByteArray,QVariant)) ); connect( mpAmazonDE, SIGNAL(imageDownloaded(QByteArray,QVariant)), this, SLOT(showImage(QByteArray,QVariant)) ); connect( mpAmazonDE, SIGNAL(message(QString,QByteArray)), this, SLOT(message(QString,QByteArray)) ); connect( satellite, SIGNAL(received(QByteArray)), this, SLOT(handleSatelliteMessage(QByteArray)) ); QList<int> sizes; sizes << 30 << 300; s->setSizes( sizes ); }
KuickShow::KuickShow( const char *name ) : KMainWindow( 0L, name ), m_slideshowCycle( 1 ), fileWidget( 0L ), dialog( 0L ), id( 0L ), m_viewer( 0L ), oneWindowAction( 0L ), m_accel( 0L ), m_delayedRepeatItem( 0L ), m_slideShowStopped(false) { aboutWidget = 0L; kdata = new KuickData; kdata->load(); initImlib(); resize( 400, 500 ); m_slideTimer = new QTimer( this ); connect( m_slideTimer, SIGNAL( timeout() ), SLOT( nextSlide() )); KConfig *kc = KGlobal::config(); bool isDir = false; // true if we get a directory on the commandline // parse commandline options KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); // files to display // either a directory to display, an absolute path, a relative path, or a URL KURL startDir; startDir.setPath( QDir::currentDirPath() + '/' ); int numArgs = args->count(); if ( numArgs >= 10 ) { // Even though the 1st i18n string will never be used, it needs to exist for plural handling - mhunter if ( KMessageBox::warningYesNo( this, i18n("Do you really want to display this 1 image at the same time? This might be quite resource intensive and could overload your computer.<br>If you choose %1, only the first image will be shown.", "Do you really want to display these %n images at the same time? This might be quite resource intensive and could overload your computer.<br>If you choose %1, only the first image will be shown.", numArgs).arg(KStdGuiItem::no().plainText()), i18n("Display Multiple Images?")) != KMessageBox::Yes ) { numArgs = 1; } } for ( int i = 0; i < numArgs; i++ ) { KURL url = args->url( i ); KFileItem item( KFileItem::Unknown, KFileItem::Unknown, url, false ); // for remote URLs, we don't know if it's a file or directory, but // FileWidget::isImage() should correct in most cases. // For non-local non-images, we just assume directory. if ( FileWidget::isImage( &item ) ) { showImage( &item, true, false, true ); // show in new window, not fullscreen-forced and move to 0,0 // showImage( &item, true, false, false ); // show in new window, not fullscreen-forced and not moving to 0,0 } else if ( item.isDir() ) { startDir = url; isDir = true; } // need to check remote files else if ( !url.isLocalFile() ) { KMimeType::Ptr mime = KMimeType::findByURL( url ); QString name = mime->name(); if ( name == "application/octet-stream" ) // unknown -> stat() name = KIO::NetAccess::mimetype( url, this ); // text/* is a hack for bugs.kde.org-attached-images urls. // The real problem here is that NetAccess::mimetype does a HTTP HEAD, which doesn't // always return the right mimetype. The rest of KDE start a get() instead.... if ( name.startsWith( "image/" ) || name.startsWith( "text/" ) ) { FileWidget::setImage( item, true ); showImage( &item, true, false, true ); } else // assume directory, KDirLister will tell us if we can't list { startDir = url; isDir = true; } } // else // we don't handle local non-images } if ( (kdata->startInLastDir && args->count() == 0) || args->isSet( "lastfolder" )) { kc->setGroup( "SessionSettings"); startDir = kc->readPathEntry( "CurrentDirectory", startDir.url() ); } if ( s_viewers.isEmpty() || isDir ) { initGUI( startDir ); if (!kapp->isRestored()) // during session management, readProperties() will show() show(); } else { // don't show browser, when image on commandline hide(); KStartupInfo::appStarted(); } }
void MyWindow::reset() { d.reset(); showImage(); }
/** * reset - cancel the processing and reset the image * */ void MainWindow::reset() { temp = src.clone(); showImage(temp); }
/* ----------------------------------------------------------------------- */ void ScanGallery::slotUnloadItems() { FileTreeViewItem *curr = highlightedFileTreeViewItem(); emit showImage(NULL,false); slotUnloadItem(curr); }
void ViewAdapter::showSegmentedImage(string winName, Mat img) { showImage(winName, convertToColorForBaby(img)); }
uint8_t Gallery::showPrevious() { if (_index==0) _index=_gallery.size(); else _index--; return showImage(_index); }
ossimRefPtr<ossimImageData> ossimTileToIplFilter::getTile(const ossimIrect& tileRect, ossim_uint32 resLevel) { cout << "Getting Tile !" << endl; // Check input data sources for valid and null tiles ossimImageSource *imageSource = PTR_CAST(ossimImageSource, getInput(0)); ossimRefPtr<ossimImageData> imageSourceData; if (imageSource) imageSourceData = imageSource->getTile(tileRect, resLevel); if (!isSourceEnabled()) return imageSourceData; if (!theTile.valid()) { if(getInput(0)) { theTile = ossimImageDataFactory::instance()->create(this, this); theTile->initialize(); } } if (!imageSourceData.valid() || !theTile.valid()) return ossimRefPtr<ossimImageData>(); theTile->setOrigin(tileRect.ul()); if (theTile->getImageRectangle() != tileRect) { theTile->setImageRectangle(tileRect); theTile->initialize(); } IplImage *input = cvCreateImage(cvSize(tileRect.width(), tileRect.height()),IPL_DEPTH_8U,3); IplImage *output = cvCreateImage(cvSize(tileRect.width(),tileRect.height()),IPL_DEPTH_8U,3); cvZero(input); cvZero(output); // If 16 or 32 bits, downsample to 8 bits ossimScalarType inputType = imageSourceData->getScalarType(); if(inputType == OSSIM_UINT16 || inputType == OSSIM_USHORT11) CopyTileToIplImage(static_cast<ossim_uint16>(0), imageSourceData, input, tileRect); else CopyTileToIplImage(static_cast<ossim_uint8>(0), imageSourceData, input, tileRect); cvCopy(input, output); int bins = 256; int hsize[] = {bins}; float binVal; float sum=0; int firstIndexFlag = 1; /*// Create histogram of image CvHistogram *hist; hist = cvCreateHist(1, hsize, CV_HIST_ARRAY, 0, 1); cvCalcHist(&input, hist, 0, 0); cvNormalizeHist(hist, 100); binVal = cvQueryHistValue_1D(hist,1); */ // Determine the actual height and width of each tile ossimIrect fullImageRect; fullImageRect = imageSource->getBoundingRect(0); ossim_int32 tileHeight, tileWidth, imageWidth, imageHeight; tileHeight = tileRect.height(); tileWidth = tileRect.width(); imageWidth = fullImageRect.width(); imageHeight = fullImageRect.height(); ossim_int32 totRows, totCols; totRows = (ossim_uint32)round(imageHeight / tileHeight); totCols = (ossim_uint32)round(imageWidth / tileWidth); ossimIpt upperLeftTile = tileRect.ul(); if ((upperLeftTile.x + 1) > fullImageRect.ul().x + totCols * tileWidth) tileWidth = imageWidth - totCols * tileWidth; if ((upperLeftTile.y + 1) > fullImageRect.ul().y + totRows * tileHeight) tileHeight = imageHeight - totRows * tileHeight; //Begin Ship Detect Algorithim // Create sub-image to ignore zeros created by OSSIM // ie, the tile is 512x512 but on the edges, the information is only in 512x10 CvRect subRect = cvRect(0, 0, tileWidth, tileHeight); IplImage *subImg = cvCreateImage(cvSize(tileWidth, tileHeight),IPL_DEPTH_8U,3); cvSetImageROI(input, subRect); cvCopy(input, subImg); cvResetImageROI(input); showImage(subImg,input); cvReleaseImage(&input); cvReleaseImage(&output); return theTile; }