Giter Site home page Giter Site logo

pyloncamqtdemo's People

Contributors

arkceajin avatar matthewawesome avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pyloncamqtdemo's Issues

OnGrabError msg=Cannot convert image. The passed source image is invalid

Hi,
I tried to use 2 GigE cameras but one camera is raising an exception after 5 seconds :

LOG : pylon.base.InstantCamera : Camera 0000015C4813CD10: OnGrabError msg=Cannot convert image. The passed source image is invalid. : InvalidArgumentException thrown (file 'imageformatconverter.cpp', line 77)

I did few changes here :

QPylonCamera::QPylonCamera(QObject *parent,int id) :
    QObject(parent),
    mImageEventHandler(new QPylonImageEventHandler(this)),
    mVideoSurface(Q_NULLPTR),
    mCamera(Q_NULLPTR),
    mRect()

{
    cam=id;
    PylonInitialize();
    open();

    connect(qApp, &QGuiApplication::aboutToQuit, [=]() {
        stopGrabbing();

        mCamera->DeregisterImageEventHandler(mImageEventHandler);
        mCamera->Close();
        mCamera->DestroyDevice();
        delete mCamera;
        mCamera = Q_NULLPTR;

        PylonTerminate();
    });
}

and Here:

void QPylonCamera::open()
{
    if(isOpen())
        return;

    try {
        // Create an instant camera object with the camera device found first.
        DeviceInfoList_t devices;
        CTlFactory& tlFactory = CTlFactory::GetInstance();
        if (tlFactory.EnumerateDevices( devices ) == 0)
        {
            qDebug()<<"No Camera Found";

        }

        mCamera = new CInstantCamera(tlFactory.CreateDevice(devices[cam]));

        // Print the camera information.
        qInfo()<<"Using device : "<< mCamera->GetDeviceInfo().GetModelName();
        qInfo()<<"Friendly Name: "<< mCamera->GetDeviceInfo().GetFriendlyName();
        qInfo()<<"Full Name    : "<< mCamera->GetDeviceInfo().GetFullName();
        qInfo()<<"SerialNumber : "<< mCamera->GetDeviceInfo().GetSerialNumber();

        // Handle image event
        mCamera->RegisterImageEventHandler(mImageEventHandler, RegistrationMode_Append, Cleanup_Delete);

        mCamera->Open();

        // Get the integer nodes describing the AOI.
        const INodeMap& nodemap = mCamera->GetNodeMap();
        CIntegerPtr offsetX( nodemap.GetNode( "OffsetX"));
        CIntegerPtr offsetY( nodemap.GetNode( "OffsetY"));
        CIntegerPtr width(   nodemap.GetNode( "Width"));
        CIntegerPtr height(  nodemap.GetNode( "Height"));

        qInfo()<<"OffsetX: "<<offsetX->GetValue();
        qInfo()<<"OffsetY: "<<offsetY->GetValue();
        qInfo()<<"Width: "<<width->GetValue();
        qInfo()<<"Height: "<<height->GetValue();
        mRect = QRect(offsetX->GetValue(),
                      offsetY->GetValue(),
                      width->GetValue(),
                      height->GetValue());

    }  catch (GenICam::GenericException &e) {
        mCamera = Q_NULLPTR;
        qWarning() << "Camera Error: " << e.GetDescription();
    }
}

And in the main.cpp

engine.rootContext()->setContextProperty("cam1", new QPylonCamera(Q_NULLPTR,0));
engine.rootContext()->setContextProperty("cam2", new QPylonCamera(Q_NULLPTR,1));

NVIDIA Jetson ARM Support (GCC/NVCC)

Hi there,

I've tweaked your repo and made it useable with and NVIDIA Jetson Nano device. Let me know if you're interested in updating this repo. Happy to drop a pull request if you still want to maintain this code.

Be Awesome!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.