Setting custom camera aspect ratio to match displays

SLP v2 RaspiOS image discussion
Post Reply
NotPorgu
Posts: 10
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: 938
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: 10
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: 10
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: 938
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
NotPorgu
Posts: 10
Joined: Sun Feb 02, 2025 4:47 pm

Re: Setting custom camera aspect ratio to match displays

Post by NotPorgu »

So I recently bought a cm4108016 to hopefully increase stability and future proof my project. It's only caused me problems.

I had the CM4 lite working just fine off of the SD card provided in the kit. However, when I tried to install the SLP image via Raspberri Pi imager, everything started to fall apart. First, using the SLP image provide here, I was not able to connect to WIFI, no matter what I tried, and HDMI wasn't outputting to my custom display either. I was able to hook it up to a regular monitor and verify that it was in fact working, but no matter what I did I couldn't get the server to load to manage files. (even tried ethernet to no avail).

That led me to try and use the beta SLP version , and that was able to access wifi and get the server up and running. However, even after copying over the config file, cosmostreamer file, and the stereopi file from the SD card I was using for the CM4 lite, the display refused to work correctly. I've spent hours attempting to modify the config file, adjusting HDMI timings, following guides, and nothing's worked. What's worse, in the process of trying to rewrite the image on the EMMC many times trying to get something wifi working, I accidentally overwrote the SD card and lost the files I had working for the lite. I do have copies of the config and cosmostreamer file saved elsewhere, but they weren't the most up to date versions, and I don't have anything else.

Anyway, for some reason it looks like the beta version of SLP is forcing a resolution to the HDMI despite having HDMI timings set to something else. Also, command lines aren't behaving as expected, and I've been unable to stop scripts or anything like that even in read-write mode. I'm really not sure what I'm supposed to do, I've tried everything my walnut brain can think of. Not sure if these issues are relevant to this post or if it required a new one.
NotPorgu
Posts: 10
Joined: Sun Feb 02, 2025 4:47 pm

Re: Setting custom camera aspect ratio to match displays

Post by NotPorgu »

Here's some pictures of what's going on:

what the display is outputting:
Image

What the server is showing:
Image

Server display settings:
Image

Config file (some parts left out):

Code: Select all

disable_splash=1

disable_overscan=1

sdtv_mode=0
sdtv_aspect=3

arm_freq=800

start_x=1
gpu_mem=512
enable_uart=1
dtoverlay=miniuart-bt
dtoverlay=dwc2,dr_mode=host

hdmi_force_hotplug=1
hdmi_group=2
hdmi_mode=87
hdmi_force_mode=1
config_hdmi_boost=4

hdmi_timings=2880 1 10 15 10 1440 1 1 1 13 0 0 0 60 0 253432200 1

Also completely unrelated but I'm curious so I thought I'd ask. Has anyone tested compatibility with new new CM5? From what I've seen it's a drop in upgrade and my project might really benefit from increased processing speed.
NotPorgu
Posts: 10
Joined: Sun Feb 02, 2025 4:47 pm

Re: Setting custom camera aspect ratio to match displays

Post by NotPorgu »

Ok I am getting very confused now, heh

I decided to try the newest install of the SLP2 image, in an attempt to start over and see if I've missed anything. Instead of trying to configure it right off the bat, I wrote the image onto the PI and booted it as is. Sure enough, the Wifi access point worked beautifully (once I figured out how to get to it lol), I was able to open up the page and make changes as normal. However it wasn't outputting video, at all. The HDMI was blank, as was the live stream on the access point, even though it said 2 cameras detected. I thought I'd put off figuring that out for when I could access it through wifi, as I was having to use my phone as opposed to my desktop and it was awkward to navigate. I tried to set up the wifi connection through the access point, putting in all the correct info for my wifi router, and then....

Nothing. The access point went down to switch to the wifi, but it's been about 10 minutes and stereopi.local still hasn't loaded. So now I have no wifi connection, and no image output. I wish I could figure this out but I'm pretty stuck at the moment.
Post Reply