Image Distortion with Basler

548 views
Skip to first unread message

Wesley Clawson

unread,
Feb 9, 2021, 3:37:26 PM2/9/21
to Bonsai Users
Hi! I'm having a similar issue as the one that was posted here:

https://groups.google.com/g/bonsai-users/c/bdUFDw7CkH4/m/fHGYo3fJAAAJ

However, the fix that seemed to work for him is not working for me, nor is really the solution that I'd need to fit into my pipeline.

I'm using a Basler GigE camera, and on the Pylon viewer (5.1), everything seems ok, but the image that's coming out of PylonCapture is distorted, and 'tiled' a bit. The color is off as well.

I've tried playing with some of the settings in PylonViewer, but can't find anything that seems to fix this.

I've attached some photos and the .pfs file here:

https://docs.google.com/document/d/14gqIjbXqcEEzMrcUaUk79ixCIdjvArmBP9FZ6Pjp004/edit?usp=sharing

As well as the output of Video saver, also made using the same fix suggested in the thread above.

Anyone else having issues like this?


Wesley Clawson

unread,
Feb 9, 2021, 3:39:12 PM2/9/21
to Bonsai Users

Ori Yarden

unread,
Feb 9, 2021, 3:44:14 PM2/9/21
to Wesley Clawson, Bonsai Users
It doesn't look distorted to me? If the camera isn't exactly centered above the arena then, similar to my setup, the wide lens of the camera causes a slight (but not unreasonable) distortion towards the edges of the frame. Also, aligning the area perpendicular or parallel to the frame of the camera helps reduce this bit of distortion.

Best,

On Tue, Feb 9, 2021 at 3:39 PM Wesley Clawson <wesley.p...@gmail.com> wrote:
    EXTERNAL EMAIL : Exercise caution when responding, opening links, or opening attachments.
 
--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/bc4793c3-0f43-426a-944c-bec78e5699b7n%40googlegroups.com.


--
Ori Yarden
Teacher's Assistant
Psychology Department
Florida Atlantic University
BS-12, room 123
Boca Raton, FL 33431

Wesley Clawson

unread,
Feb 9, 2021, 3:48:21 PM2/9/21
to Bonsai Users
Hey! Thanks for hopping in.

Are you looking at the picture on the second page of the linked google doc? Sorry I was not specific. The distortion is not in the edges of the frame, but across the screen.

Here's Pylon viewer:
pylon.png


Here's bonsai:

bonsai.png

So no matter what settings I mess with, I can't get the image non-tessellated and the colors to what I see in the pylon viewer.

- Wes

Ori Yarden

unread,
Feb 9, 2021, 3:50:01 PM2/9/21
to Wesley Clawson, Bonsai Users
Oh I did not see the second image you attached; that looks distorted. Have you (properly) configured the camera? Using pylon viewer you can configure the camera so that it operates on the parameters you define, and it allows you to save it and Bonsai allows you to upload that configuration file. I would speculate that the parameters for the frame's pixel height x width or somewhere around there needs to be adjusted or re-adjusted.

Best,

Ori Yarden

unread,
Feb 9, 2021, 3:51:53 PM2/9/21
to Wesley Clawson, Bonsai Users
Can you send your workflow (or a screenshot of it)?

Best,

Wesley Clawson

unread,
Feb 9, 2021, 3:57:03 PM2/9/21
to Bonsai Users
Sure thing!

Here's the workflow (and the visualizer is turned on for 'Image'). It's incredibly simple, as I was trying to make sure the video part was working before adding more.
workflow.png

And here's the relevant options (I think) in the Basler software:
baslar pixel.png

I've tried selecting/saving/reloading the settings file with each possible Pixel format, but none change the output of the camera on Bonsai. Pixel Format is the only thing I can change, the rest are 'greyed' out.

Ori Yarden

unread,
Feb 9, 2021, 4:05:19 PM2/9/21
to Wesley Clawson, Bonsai Users
Right now the only difference I'm seeing is that my configuration uses "Bayer BG 8" while yours is set to "YUV 422 (YUYV) Packed." If that doesn't work I can send you my configuration if that helps. One important parameter which caused issues that I initially experienced was under the acquisition controls; the frame rate must be set correctly (and often the default isn't set correctly; at least from what I've encountered) in order for the camera to work properly with Bonsai. However, your issue is frame distortion which wasn't an issue when I had to adjust the frame rate for my cameras.

Best,

Ori Yarden

unread,
Feb 9, 2021, 4:08:06 PM2/9/21
to Wesley Clawson, Bonsai Users
To see how your camera operates with its manufactured settings, in pylon viewer you can "run a test" with the camera to see what it's doing live (eg frame rate, packet size, mb/second, etc.). If your parameters do not exceed the camera's abilities (ie manufactured settings) then it should work; if not, it's probably the parameters that need adjusting which by default usually aren't correct.

Best,

Wesley Clawson

unread,
Feb 9, 2021, 4:10:55 PM2/9/21
to Bonsai Users
Ahhh okay - I will spend some time with that. I assumed (naively) that a lot of the settings were default, and were good.

Any hard limits (frame rate, etc.) that you ran into that you'd suggest double checking?

Ori Yarden

unread,
Feb 9, 2021, 4:29:19 PM2/9/21
to Wesley Clawson, Bonsai Users
Yes, so for example my camera has a frame rate of 60 frames per second but I need it to run at 30 frames per second; as well, the initial default pylon viewer settings would have it at 10 frames per second. When running Bonsai, without the configuration file the workflow would crash because the camera was asking for too many frames that Bonsai was not able to provide, and with the default configuration settings the workflow would also crash for similar reasons. So I set it to 30 frames per second, I saved the configuration file, and I uploaded that configuration file to Bonsai and everything has been working since. If it makes it easier, save whatever configuration file you have and open it using the "Notes" application since it conveys all of the information line-by-line and it's much easier to go through and try to understand it or compare it to another configuration file.

Again, acquisition controls are probably the parameters you want to look into (but maybe not since your issue seems fairly different from the ones I've encountered with my cameras); majority of these parameters you and I probably don't understand, but if you see anything that seems incorrect (like when I noticed my camera's settings for frame rate were obviously not what they should have been) you can adjust it and see if it solves the issue.

Best,

Ori Yarden

unread,
Feb 9, 2021, 4:31:20 PM2/9/21
to Wesley Clawson, Bonsai Users
If you want to send a screenshot of your entire list of parameters/settings I can skim through to see if there's anything that is obviously incorrect.

Best,

Wesley Clawson

unread,
Feb 9, 2021, 4:36:06 PM2/9/21
to Bonsai Users
Here's my pfs file that I tried before I left the lab today.
https://drive.google.com/file/d/1EnFcjKVhm8cjLqjlDl6seSDvM_oErYXy/view?usp=sharing

Tomorrow though I'll go through and check everything that look out of place.

Thanks for the helpful leads!

- Wes

Wesley Clawson

unread,
Feb 10, 2021, 5:55:30 AM2/10/21
to Bonsai Users
As an update to anyone with similar problems, I had to go into the .pfs file and change:

Width    1278
Height    958

to

Width    1280
Height    964

As well as changing the FrameRate inside of PylonViewer to 30 (which snaps to 30.0003).

Works fine now!

Ori Yarden

unread,
Feb 10, 2021, 8:23:59 AM2/10/21
to Wesley Clawson, Bonsai Users
Glad to hear!

Best,

On Wed, Feb 10, 2021 at 5:55 AM Wesley Clawson <wesley.p...@gmail.com> wrote:
    EXTERNAL EMAIL : Exercise caution when responding, opening links, or opening attachments.
 

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages