0

我有这个程序,我复制了另一个帖子:Sapera++ API with Qt undefined reference to '_imp__ZN11SapLocation 我的程序是:

SapCamara1.pro

#-------------------------------------------------
#
# Project created by QtCreator 2021-07-06T09:36:29
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = SapCamara1
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

#CONFIG += c++11 #puede comentarse

SOURCES += \
        main.cpp \
        mainwindow.cpp

HEADERS += \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapAcqDevice.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapAcqToBufThruCab.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapAcquisition.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapBayer.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapBuffer.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapBufferRemote.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapBufferRoi.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapBufferWithTrash.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapBufferWithTrashAndRoi.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapCab.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapClassBasic.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapClassBasicDef.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapClassBasicObsolete.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapClassBasicRes.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapColorConversion.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapCounter.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapData.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapDisplay.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapDynamicLut.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapFeature.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapFlatField.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapGio.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapGraphic.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapLut.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapManager.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapMetadata.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapMultiAcqToBufThruCab.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapPerformance.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapPixPro.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapProcessing.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapRTPro.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapRTProDesign.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapRTProDesignOnBrdBuffers.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapTransfer.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapTransferEx.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapView.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapXferMultiNode.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/SapXferNode.h \
#        ../../../../../../../Program Files/Teledyne DALSA/Sapera/Classes/Basic/corenv.h \
        mainwindow.h

FORMS += \
        mainwindow.ui

INCLUDEPATH += 'C:\Program Files\Teledyne DALSA\Sapera\Classes\Basic'
INCLUDEPATH += 'C:\Program Files\Teledyne DALSA\Sapera\Include'
INCLUDEPATH += 'C:\Program Files\Teledyne DALSA\Sapera\Lib'

LIBS += 'C:\Program Files\Teledyne DALSA\Sapera\Lib\Win64\SapClassBasic.lib'



# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

主窗口.h

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H

主文件

#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
}

而且我不确定我是否正确放置了 SapAcquisition 请求的参数的索引和资源文件。 主窗口.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"

#include "SapClassBasic.h"
#include "SapAcquisition.h"

HWND disp;
//bool success;


MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //disp=(HWND)ui->graphicsView->winId();
    disp=(HWND)ui->graphicsView->winId();
    SapAcquisition *pAcq=new SapAcquisition(SapLocation("Nano-M1450_1",1),"T_Nano-M1450_IAB_1.ccf");
    //Nano-M1450
    //T_Nano-M1450_IAB_1.ccf

    SapBuffer *pBuffer=new SapBuffer(1,pAcq);
    //SapView *pView=new SapView(pBuffer,disp);
}

MainWindow::~MainWindow()
{
    delete ui;
}

但我看不到相机的图像:

09:35:29: Starting C:\Users\MSA\Desktop\Adrian Pilataxi\tutorial open cv camara\SapCamara1\build-SapCamara1-Desktop_Qt_5_11_1_MSVC2015_64bit-Debug\debug\SapCamara1.exe ...
=>LOG :  : Loading logger parameter file 'C:\Program Files\GenICam_v2_4\log\config\DebugLogging.properties'
09:35:33: C:/Users/MSA/Desktop/Adrian Pilataxi/tutorial open cv camara/SapCamara1/build-SapCamara1-Desktop_Qt_5_11_1_MSVC2015_64bit-Debug/debug/SapCamara1.exe exited with code 0

我正在使用的相机是:Teledyne DALSA 的 GenieNano 系列的 Nano-M1450,我不知道是否有人可以帮助我提供任何建议,以便能够通过 GUI 观察从相机获得的图像。

4

0 回答 0