本文整理汇总了C++中ImageViewer类的典型用法代码示例。如果您正苦于以下问题:C++ ImageViewer类的具体用法?C++ ImageViewer怎么用?C++ ImageViewer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImageViewer类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getViewer
void Tools::houghLines()
{
ImageViewer* iv = getViewer();
if (!SupportedImageFormat(iv, QList<QImage::Format>() << QImage::Format_RGB32))
return;
HoughLinesDialog dialog;
if (dialog.exec() == QDialog::Rejected)
return;
HoughLines* hl = new HoughLines(iv->getImage(), iv);
hl->setParameter("threshold", dialog.getThreshold());
hl->setParameter("draw_whole_lines", dialog.getDrawWholeLines());
hl->start();
}
示例2: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QGuiApplication::setApplicationDisplayName(ImageViewer::tr("Image Viewer"));
QCommandLineParser commandLineParser;
commandLineParser.addHelpOption();
commandLineParser.addPositionalArgument(ImageViewer::tr("[file]"), ImageViewer::tr("Image file to open."));
commandLineParser.process(QCoreApplication::arguments());
ImageViewer imageViewer;
if (!commandLineParser.positionalArguments().isEmpty()
&& !imageViewer.loadFile(commandLineParser.positionalArguments().front())) {
return -1;
}
imageViewer.show();
return app.exec();
}
示例3: ImageViewer
void MainWindow::showSelectedSurface()
{
QTreeWidgetItem *item =
m_ui.surfacesTreeWidget->currentItem();
if (!item) {
return;
}
QVariant var = item->data(0, Qt::UserRole);
if (!var.isValid()) {
return;
}
ImageViewer *viewer = new ImageViewer(this);
QString title;
if (selectedCall()) {
title = tr("QApiTrace - Surface at %1 (%2)")
.arg(selectedCall()->name())
.arg(selectedCall()->index());
} else {
title = tr("QApiTrace - Surface Viewer");
}
viewer->setWindowTitle(title);
viewer->setAttribute(Qt::WA_DeleteOnClose, true);
QByteArray base64Data = var.value<QByteArray>();
viewer->setBase64Data(base64Data);
viewer->show();
viewer->raise();
viewer->activateWindow();
}
示例4: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QGuiApplication::setApplicationDisplayName(ImageViewer::tr("Image Viewer"));
QCommandLineParser commandLineParser;
commandLineParser.addHelpOption();
commandLineParser.addPositionalArgument(ImageViewer::tr("[file]"), ImageViewer::tr("Image file to open."));
commandLineParser.process(QCoreApplication::arguments());
ImageViewer imageViewer;
if (!commandLineParser.positionalArguments().isEmpty()
&& !imageViewer.loadFile(commandLineParser.positionalArguments().front())) {
return -1;
}
imageViewer.show();
QObject::connect(&app, SIGNAL(aboutToQuit()), &imageViewer, SLOT(saveExit()));
//imageViewer.showMaximized();
return app.exec();
}
示例5: main
int main(){
IEEE1394Cam ic;
ImageViewer iv;
ic.setPixelType(ALTH::PIXEL_RGB);
ic.Opens();
int w, h;
ic.getImageSize(&w, &h);
unsigned char *buf = new unsigned char[w*h*3];
iv.openWindow("test window", w, h);
for(int i=0; i<100; ++i){
ic.CaptureImages(buf);
iv.showImage(buf);
}
ic.Closes();
iv.closeWindow();
return 0;
}
示例6: rech
//TODO: la recherche doit renvoyer les 3 resultats les plus coherents
// elle les affiche ds 1 qpushbutton chacun, le clic devant provoquer l'affichage du tab correspondant
void SearchDialog::searchImage()
{
QString rech(searchField->text());
ImageViewer * parent = (ImageViewer *)this->parentWidget();
QString res1;
QString res2;
QString res3;
for(int i = 0;i < parent->getImgDescrListSize();i++)
{
if (!parent->getImgDescrList(i)->getKeyWord().isEmpty())
{
int dist = levDistance(rech, parent->getImgDescrList(i)->getKeyWord());
// recalcul des 3 meilleurs resultats
}
}
// mise en place des label des qpushbutton
}
示例7: foreach
void SiftGui::loadImage()
{
QStringList filename = QFileDialog::getOpenFileNames(this, "Please select an input image file.", ".", "*.jpg *.png *.bmp *.tiff *.pgm");
foreach(QString s, filename)
{
// skip images already loaded
if(_infilelist.contains(s))
continue;
QImage srcImg(s);
ImageViewer* srcViewer = new ImageViewer(_imageContainer);
srcViewer->setImage(srcImg);
srcViewer->setWindowTitle(s);
srcViewer->setSignature(s);
connect(srcViewer, SIGNAL(sig_viewerClosed(QString)), this, SLOT(handleViewerClosed(QString)));
_imageContainer->addSubWindow(srcViewer);
srcViewer->show();
_infilelist.push_back(s);
}
}
示例8: main
int main( int argc, char **argv )
{
if ( argc > 1 && QString(argv[1]) == "-m" ) {
QApplication::setColorSpec( QApplication::ManyColor );
argc--;
argv++;
}
else if ( argc > 1 && QString(argv[1]) == "-n" ) {
QApplication::setColorSpec( QApplication::NormalColor );
argc--;
argv++;
}
else {
QApplication::setColorSpec( QApplication::CustomColor );
}
QApplication::setFont( QFont("Helvetica", 12) );
QApplication a( argc, argv );
ImageIconProvider iip;
QFileDialog::setIconProvider( &iip );
if ( argc <= 1 ) {
// Create a window which looks after its own existence.
ImageViewer *w =
new ImageViewer(0, "new window", Qt::WDestructiveClose | Qt::WResizeNoErase );
w->setCaption("Qt Example - Image Viewer");
w->show();
} else {
for ( int i=1; i<argc; i++ ) {
// Create a window which looks after its own existence.
ImageViewer *w =
new ImageViewer(0, argv[i], Qt::WDestructiveClose | Qt::WResizeNoErase );
w->setCaption("Qt Example - Image Viewer");
w->loadImage( argv[i] );
w->show();
}
}
QObject::connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()));
return a.exec();
}
示例9: on_actionNine_Images_Show_triggered
void MainWindow::on_actionNine_Images_Show_triggered()
{
ImageViewer imageViewer;
imageViewer.exec();
}
示例10: on_sliThresholdValue_valueChanged
void ThresholdingPanel::on_sliThresholdValue_valueChanged(int value){
ImageViewer* parent = qobject_cast<ImageViewer *>(this->parentWidget());
parent->thresholdAction(value, sliThresholdType->value());
}
示例11: on_sliElement_valueChanged
void DilationPanel::on_sliElement_valueChanged(int value){
ImageViewer* parent = qobject_cast<ImageViewer *>(this->parentWidget());
parent->dilationAction(sliKernelSize->value()*2+1,value);
}
示例12: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
sdl::Application app;
DepthDetector detector(ThresholdMin, ThresholdMax);
ScanLineSegmenter segmenter;
OpenNI::initialize();
Device device;
if (device.open(ANY_DEVICE) != STATUS_OK)
{
std::cout << "could not open any device\r\n";
return 1;
}
if (device.hasSensor(SENSOR_DEPTH))
{
auto info = device.getSensorInfo(SENSOR_DEPTH);
auto& modes = info->getSupportedVideoModes();
std::cout << "depth sensor supported modes:\r\n";
for (int i = 0; i < modes.getSize(); ++i)
{
auto& mode = modes[i];
std::cout << "pixel format: " << mode.getPixelFormat() << "\t with: " << mode.getResolutionX() << "x" << mode.getResolutionY() << "@" << mode.getFps() << " fps\r\n";
}
}
VideoStream stream;
stream.create(device, SENSOR_DEPTH);
VideoMode mode;
mode.setFps(25);
mode.setPixelFormat(PIXEL_FORMAT_DEPTH_1_MM);
mode.setResolution(320, 240);
stream.setMirroringEnabled(true);
stream.setVideoMode(mode);
stream.start();
std::cout << "press any key to capture background\r\n";
std::cin.get();
VideoFrameRef frame;
stream.readFrame(&frame);
DepthImage image(320, 240);
copyFrameToImage(frame, image);
detector.background(image);
std::cout << "starting capture loop\r\n";
sdl::GLContext::setVersion(4, 3);
ImageViewer viewer;
viewer.add(0, 0, 320, 240);
viewer.add(320, 0, 320, 240);
viewer.add(0, 240, 320, 240);
viewer.add(320, 240, 320, 240);
CenterPointExtractor centerPointExtractor(MinBlobSize);
MotionRecorder recorder;
while (true)
{
stream.readFrame(&frame);
copyFrameToImage(frame, image);
detector.detect(image);
std::vector<LineSegment> segments;
segmenter.segment(detector.mask(), segments);
std::vector<std::pair<float, float>> centerPoints;
centerPointExtractor.extract(segments, centerPoints);
recorder.track(centerPoints);
viewer.crosses.clear();
std::transform(begin(centerPoints), end(centerPoints), std::back_inserter(viewer.crosses), [](std::pair<float, float>& coord) {
return Cross{ coord.first, coord.second };
});
viewer.lines.clear();
std::transform(begin(recorder.motions()), end(recorder.motions()), std::back_inserter(viewer.lines), [](const Motion& motion) {
return Lines{ motion.points };
});
viewer[0].update(detector.mask());
viewer[1].update(image);
viewer[2].update(detector.background());
viewer[3].update(detector.difference());
viewer.update();
}
openni::OpenNI::shutdown();
return 0;
}
示例13: main
int main( int argc, char** argv )
{
// command line parsing
typedef vtkmetaio::MetaCommand vtkmc;
vtkmc command;
command.SetOption( "target", "t", false, "target aspect of the file to display" );
command.AddOptionField( "target", "target", vtkmc::STRING, true, "rf-bmode-volume", "bmode-scout, saturation-scout, rf-bmode-surface, or rf-bmode-volume");
command.AddField( "in_file", "Prefix of the .rdi/.rdb set of Visual Sonics raw files that should be in the same directory.", vtkmc::STRING, true );
command.SetDescription("command line application to view VisualSonics Digital RF files with VTK\n\npass one or more *.rdb or *.rdi files as arguments");
command.SetAuthor("Matt McCormick (thewtex)");
if( !command.Parse( argc, argv ) || !command.GetOptionWasSet("in_file") )
return 1;
// check input file name, truncate if needed
std::string in_file = command.GetValueAsString( "in_file" );
size_t in_file_l = in_file.length();
if( in_file_l > 3 )
{
if( !in_file.compare( in_file_l - 3, 3, ".rd" ) ) // as often occurs with tab completion
in_file = in_file.substr( 0, in_file_l - 3 );
else if( !in_file.compare( in_file_l - 4, 4, ".rdi" ) ||
!in_file.compare( in_file_l - 4, 4, ".rdb" ) )
{
in_file = in_file.substr( 0, in_file_l - 4 );
}
}
// nike
try
{
ImageViewer* vi = new ImageViewer( in_file );
std::string target = command.GetValueAsString( "target" );
if ( target == "rf-bmode-volume" )
vi->view_rf();
else if( target == "rf-bmode-surface");
//vi->view_rf_surface();
else if( target == "bmode-scout" )
vi->view_b_mode();
else if( target == "saturation-scout" )
vi->view_saturation();
// oh the horror
delete vi;
}
catch ( std::exception& e )
{
std::cerr << "There was a std::exception: " << e.what() << std::endl;
return 1;
}
return 0;
};