Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to Open camera in another class #735

Closed
SJavad opened this issue Mar 17, 2024 · 1 comment
Closed

Failed to Open camera in another class #735

SJavad opened this issue Mar 17, 2024 · 1 comment

Comments

@SJavad
Copy link

SJavad commented Mar 17, 2024

Describe what you want to implement and what the issue & the steps to reproduce it are:

I want to Open the camera in another class.
when I try open camera in class constructor, the camera was not opened and throw this exception:
terminated called after throwing an instance of 'GenICam_3_1_Basler::pylon::runtimeException'
but when I create Instance of camera in main function, I can open camera and capture frames without any problem.
I'm writing code in c++
here is the code of the class:

class CameraService
{
private:
         CInstantCamera *camera;
         CImageFormatConverter *formatconverter;
         CPylonImage *pylonimage;
public:
         CameraService(CameraParamters &CameraParameter);
         ~CameraService();
};
CameraService::CameraService(CameraParameters &CameraParameter)
{
         CInstantCamera camera(CTlFactory::GetInstance().CreateFirstDevice()); // this line throw an exception
         std::cout << "Using Camera: " << camera.GetDeviceInfo().GetModelName() << std::endl;
}

Is your camera operational in Basler pylon viewer on your platform

Yes

Hardware setup & camera model(s) used

AMD64 CPU
Ubuntu
RAM 16 GB
Camera: Ace2040-55um
USB 3.0

Runtime information:

terminated called after throwing an instance of 'GenICam_3_1_Basler::pylon::runtimeException'
@SMA2016a
Copy link
Collaborator

Just wanted to clarify that the issue described isn't actually related to pypylon.

you need to call Pylon initialize() in constructor and Terminate() in destructor.

@SJavad SJavad closed this as completed Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants