genicam / harvesters

Image Acquisition Library for GenICam-based Machine Vision System
Apache License 2.0
511 stars 87 forks source link

Low acquisition framerate (Mono16) #171

Closed ThermoGnad closed 4 years ago

ThermoGnad commented 4 years ago

Hello kazunarikudo, My current problem is related to issu #131 Unfortunately, I don't get higher framerates than around 20FPS (If the desired framrate is set to any value lower than 20 it works accurate.) To acquire and store frames in RAM i use: for i in range(n_frames): with ia.fetch_buffer() as buffer: np.copyto(frames[i], buffer.payload.components[0].data.reshape(buffer.payload.components[0].height, buffer.payload.components[0].width)) after finishing acqisition I save the frames to Disk.

Desktop (please complete the following information): OS: Windows 10, 64 bit Python: Python 3.6.8 Harvester: 1.2.3 GenTL Producer: Matrix Vision Camera: IRS640, (Automation Technology), Mono16, nominal FPS: 94.8 (due to ROI)

kazunarikudo commented 4 years ago

@ThermoGnad Hi. Thank you for creating another ticket. Okay, so how much frame rate would you get if you do not call np.copyto()?

ThermoGnad commented 4 years ago

Hi. Without the np.copyto() there is no big difference. I made a more accurate measurement (acquired 1000 frames):

kazunarikudo commented 4 years ago

@ThermoGnad Thank you for the update. Sorry for having asked you so many questions, what would happen if the pixel format was Mono8? (I'm not sure if your camera supports it though.)

kazunarikudo commented 4 years ago

@ThermoGnad One more thing, could you show me the line where you call start_acquisition method, please?

ThermoGnad commented 4 years ago

@kazunarikudo Unfortunately, my camera does not support Mono8.

my script is nearly the same as the script of bobcorn. The function starting acquisition:

`def init_camera(fps): ia = None

h = Harvester()
h.add_cti_file(SDK_CTI_PATH)
h.update_device_info_list()

try:
    ia = h.create_image_acquirer(serial_number=CAMERA_SN)
except:
    print("[ERROR] Camera with specified model \"" + CAMERA_SN + "\" is busy or not connected.")
    exit(1)

ia.remote_device.node_map.Width.value = WIDTH
ia.remote_device.node_map.Height.value = HEIGHT
ia.remote_device.node_map.PixelFormat.value = PIXEL_FORMAT
ia.remote_device.node_map.AcquisitionFrameRate.value = fps

ia.start_acquisition()

return h, ia`

calling this just before fetching the buffer:

h, ia = init_camera(fps)

kazunarikudo commented 4 years ago

@ThermoGnad Thank you for the update. Okay, so could you check if you can acquire images at 90 fps using another library? I feel a bit strange because you can acquire images, I mean valid images that are not None. It means Harvester has interpreted the delivered data in the declared pixel format. And you are trying to acquire Mono16 images and it's one of simple pixel data formats like Mono8. I have received a report from a user that says Harvester can acquire Mono8 4M pix images at about 200 fps. So I would expect you should be able to acquire the images at 90 fps as you expect. Of course, I admit a fact that you are facing the issue anyway and there must be a reason that brings up the result.

kazunarikudo commented 4 years ago

@ThermoGnad I have just checked out AT's flyer for IRS640 at here. I am not willing to stick my mind on Mono8 but the flyer seems to be saying it supports 8-bit output (I'm not sure if it's Mono8, to be honest). Please never mind if it does not support Mono8 anyway. However, again, even if the pixel format was Mono16, it is strange to hear the frame rate is limited to about 20 fps for an image that is smaller than VGA. I guess you should be able to acquire a mono VGA image at about 340 fps on gigabit Ethernet. Even if the format was Mono16, 20 fps is much smaller.

ThermoGnad commented 4 years ago

@kazunarikudo Sorry for my late response. I have a older version of the camera you linked in your last post and I think Mono8 is not possible but I will check this with the manufacturer. I did a small investigation and

So, I think that the camera is working properly. What am I doing wrong when using harvesters? I schould have made this tests bevor opening an issue, sorry. Is there any other information I should provide?

kazunarikudo commented 4 years ago

@ThermoGnad Thank you for the update. I would not stick my mind on Mono8 but would be able to try another model so that you can acquire images at the frame rate that you expected? Or it's not a bad idea to ask AT if they can get the expected result with Harvster. I have a good friend at AT; his name is Stephan K. Just reffering to his name an AT person could transfer you to the right person.

ThermoGnad commented 4 years ago

@kazunarikudo Contacting AT seems to be the best idea, especially if they konw you and harvesters. Futhermore, I have a Flir A35, running with 60fps (Mono8, Mono14, Mono16) Unfortunately, this one is not working at all with harvesters: File "C:\...\venv\lib\site-packages\harvesters\core.py", line 2484, in fetch_buffer raise TimeoutException _gentl.TimeoutException I think it is because that camera has noch bool if it is acquiring? (Acquisition with Matlab working stable) I will try to call Stephan know...

ThermoGnad commented 4 years ago

@kazunarikudo Update for you: Stephan is currently on vacation. But his collegue will call me back to discuss the problem. (For your personal interest: Stephan K. is now Stephan R., he recently married) ;)

kazunarikudo commented 4 years ago

Closing. Please feel free to reopen this ticket if there's a bug.