Setting custom camera aspect ratio to match displays

SLP v2 RaspiOS image discussion
Post Reply
NotPorgu
Posts: 3
Joined: Sun Feb 02, 2025 4:47 pm

Setting custom camera aspect ratio to match displays

Post by NotPorgu »

Hello, I'm a total rookie in regards to raspberrypi, but I'm trying to learn so I can finish this project. I'm trying to create a custom vr/ar headset for a cosplay piece that needs video pass through due to visibility issues.

My issue is that the displays I got are not working quite right, there are white bars on either side of the screens, which I'm concerned will make it difficult to see due to the light bleeding. Image

Originally, I thought this was due to improperly configured hdmi_timings, so I reached out to the manufacturer to see what values the displays require. I haven't heard back, but I realized something that made me think that wasn't it. The white bars are present on the 2" tft display too...
Image


I think the borders of the screens simply aren't being updated after the stereopi logo loads, since the cameras are only outputting a 16:9 image, whereas the displays are forcing a 2:1 ratio.

My question is this, is it possible for the pi to stitch together two 720x720 images instead of two 720x640 images? I'm not sure how I would change this, or if it's just limited by the hardware itself and impossible.

If it's not possible, how would I fix the white bar issue to turn them black to limit the light bleed through?

I have about a thousand more questions, but this is where I'm at right now. If more info is required I'll do my best to provide it. I appreciate any help ^ ^

User avatar
Realizator
Site Admin
Posts: 919
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: Setting custom camera aspect ratio to match displays

Post by Realizator »

Hello NotPorgu,

I see both IPS and HDMI screens have the same issue (bars), AND these bars are not colored or messy. I gues your HDMI timings are correct, and maybe the original image does not fit the screen.

Could you please tell me:
1. Which version of the software you are using?
2. What are the camera settings?
3. What's the real resolution of your HDMI display?

You can set any resolution, but the camera capture software has internal limitations.

To play with these settings you can choose one of these ways:
1. Use remote access to the StereoPi with SLP2 installed. When you disable the running scripts, you can run your test commands with video for different resolutions and check the mode for your case.
2. Use OpenCV desktop image, and put the commands in the terminal directly.
(both images are here)

Here is a simple example:

Code: Select all

raspivid -3d sbs -w 1440 -h 720
When you find your solution, you can "hardcode" your resolution in the SLP image.
Eugene a.k.a. Realizator

NotPorgu
Posts: 3
Joined: Sun Feb 02, 2025 4:47 pm

Re: Setting custom camera aspect ratio to match displays

Post by NotPorgu »

I'll have to check specifics when I get home, but here's what I know.
Realizator wrote:
Mon Feb 03, 2025 6:31 pm
Could you please tell me:
1. Which version of the software you are using?
Can't say for 100% certainty, but I believe it's the latest available, as I bought the stereopi v2 kit from crowd supply only a few weeks ago, and I'm using the supplied micro SD.
Realizator wrote:
Mon Feb 03, 2025 6:31 pm
2. What are the camera settings?
Luckily I saved off the config and cosmostreamer file and was able to find this:

Code: Select all

internal_camera_params="-w 1280 -h 720 -fps 48 --bitrate 2000000 --preview 100,100,320,200"
Realizator wrote:
Mon Feb 03, 2025 6:31 pm
3. What's the real resolution of your HDMI display?
The displays combined are 2880x1440p. I'm willing to sacrifice resolution in favor of better FPS to prevent feeling nauseous over time.

I appreciate the advice! It'll give me a good place to start when I get home after work

NotPorgu
Posts: 3
Joined: Sun Feb 02, 2025 4:47 pm

Re: Setting custom camera aspect ratio to match displays

Post by NotPorgu »

I meant to update this last night when I was actually home and had access to everything, so apologies for no pictures.

Long story short, it works! Ready to burn the next bridge as I cross it haha.

A few interesting things to note though,
Realizator wrote:
Mon Feb 03, 2025 6:31 pm

Code: Select all

raspivid -3d sbs -w 1440 -h 720
When I stopped all the scripts, and experimented with this code in the console, for some reason it would only work correctly with a 4:1 aspect ratio. I tried the example above, and I tried 2880x1440, but both still gave a horizontally squished result for some reason. Just to try things out, I tried 1440x360 and it worked, albeit at a very low resolution. Not sure why this is the case. I also tried 2880x720 and that also gave me a good image.

Once I had the image working, I poked around and found the setting to change in the stereopi.conf file, and changed the camera resolution to 1440x720. Rebooting the pi gave me the desired image, both screens fully utilized.

I've got a lot more to this project I've got to figure out, but I'll start from here and brute force it if I have to. Really grateful for stereopi, it seems like the perfect foundation for what I'm trying to accomplish.

User avatar
Realizator
Site Admin
Posts: 919
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: Setting custom camera aspect ratio to match displays

Post by Realizator »

NotPorgu wrote:
Tue Feb 04, 2025 11:49 am
I meant to update this last night when I was actually home and had access to everything, so apologies for no pictures.

Long story short, it works! Ready to burn the next bridge as I cross it haha.
Congrats! :-)

As for other settings in SLP2, remember you can adjust most of the parameters in the admin panel but not in the config file. It might save you some time.
Eugene a.k.a. Realizator

Post Reply