question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

grabResult.GrabSucceeded()==True rarely

See original GitHub issue

Type of Issues

Enhancement/Error

Operating System

Windows 64

Python version

3.7.9

pypylon version

1.5.4

Basler camera

acA1300-30g

Description of Problem / Question / Details

My target is to grab a single photo when a button is pressed in a GUI. The method triggered now is the one reported below:

import numpy as np
NULL_ARRAY=np.ndarray(shape=(0,0))

def grab_basler_photo():
    array=NULL_ARRAY
    try:
        from pypylon import pylon
        camera = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice())
        camera.Open()
        numberOfImagesToGrab = 100
        camera.StartGrabbingMax(numberOfImagesToGrab)
        while camera.IsGrabbing():
            grabResult = camera.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException)
            if grabResult.GrabSucceeded():
                array = grabResult.Array
                camera.Close()
                return array
            else:
                pass
            grabResult.Release()
        camera.Close()
    except Exception as Err:
        array=NULL_ARRAY
        logger.error('errors with pypylon\n'+Err)
    return array

As you can see, I simply want to retreive the numpy array from camera as soon as the capture is successfull (no pixels above bit depth and capture without errors/common black stripes). I want implement the fastest way to do this simple one-shot grab.

Actually it happens that often numberOfImagesToGrab = 100 is not sufficient i.e. grabResult.GrabSucceeded() is False for the most of the times… Increase the buffer rises too much computational times. On Pylon software suite the snapping process by button is quite perfect, I see promptly and always a good photo.

Thank you for everybody willing to help, and have nice Xmas holidays.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
nchauhan5commented, Mar 16, 2021

@thiesmoeller - I have the correct settings as checked from the bandwidth manager. I have the Basler aca4600-7gc Ace GigE Camera. I have the same problem. The statement - if grabResult.GrabSucceeded() is false more often than not. Like 95% of the time. This Camera at my current settings is giving out 2 frames per second as seen in the pylon viewer, but I am getting like 1 frame every 10 seconds or something.

1reaction
thiesmoellercommented, Dec 31, 2020

Hi @MCilento93 , grabbing must succeed every time with correct settings!

What you describe ( black stripes ) results from wrong bandwidth configuration. Please read the chapter on network parameters: https://docs.baslerweb.com/network-related-parameters-(gige-cameras) You can verify correct settings in the pylon viewer with the bandwidth manager: https://docs.baslerweb.com/bandwidth-manager#optimizing-bandwidth-consumption

Bandwidth manager will show you most issues, that might exists in your setup.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting started with Basler cameras - Python for the Lab
We check that the grab actually worked by using the GrabSucceeded method. Then we get the actual data using the GetArray method.
Read more >
Pylon::CGrabResultData - Basler AG
bool, GrabSucceeded() const. Returns true if an image has been grabbed successfully and false in the case of an error.
Read more >
How to set parameters of basler using python, _genicam ...
stratGrabbing() function? I am getting error like : return _genicam.IInteger_SetValue(self, Value, Verify) _genicam.AccessException: Node is not ...
Read more >
Basler pylon 2.0 - Media Performance Group
Never call free or delete on pointers created by the Transport Layer Factory. ... The RetrieveResult() method fills a Pylon::GrabResult object,.
Read more >
pypylon analysis - Snyk
StopGrabbing() is called automatically by the RetrieveResult() method # when ... GrabSucceeded(): # Access the image data. print("SizeX: ", grabResult.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found