arkceajin / pyloncamqtdemo Goto Github PK
View Code? Open in Web Editor NEWBasic Pylon Camera demo using Qt/C++
License: MIT License
Basic Pylon Camera demo using Qt/C++
License: MIT License
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));
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!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.