6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5954
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Stereoscopic camera capture - now implemented (2014).

Wed Aug 20, 2014 2:58 pm

Hi All.

So the initial stereoscopic camera code has just been submitted, and Dom is intending to do a release probably tonight.
This has been slightly rushed through to try and get it into the wild, so please report back if you hit issues, BUT there are restrictions - break the rules at your peril!

There is one new MMAL parameter that is valid on all 3 of the camera output ports - MMAL_PARAMETER_STEREOSCOPIC_MODE. It takes a MMAL_PARAMETER_STEREOSCOPIC_MODE_T

Code: Select all

typedef enum MMAL_STEREOSCOPIC_MODE_T {
   MMAL_STEREOSCOPIC_MODE_NONE = 0,
   MMAL_STEREOSCOPIC_MODE_SIDE_BY_SIDE = 1,
   MMAL_STEREOSCOPIC_MODE_TOP_BOTTOM = 2,
   MMAL_STEREOSCOPIC_MODE_MAX = 0x7FFFFFFF,
} MMAL_STEREOSCOPIC_MODE_T;

typedef struct MMAL_PARAMETER_STEREOSCOPIC_MODE_T
{
   MMAL_PARAMETER_HEADER_T hdr;

   MMAL_STEREOSCOPIC_MODE_T mode;
   MMAL_BOOL_T decimate;
   MMAL_BOOL_T swap_eyes;
} MMAL_PARAMETER_STEREOSCOPIC_MODE_T;
(Please see IL config OMX_IndexParamBrcmStereoscopicMode and struct OMX_CONFIG_BRCMSTEREOSCOPICMODETYPE if you insist on doing IL. Doh, it should be struct OMX_PARAM_BRCMSTEREOSCOPICMODETYPE to be consistent. Can't be bothered to change it!).
  • mode sets up how the stereoscopic image is to be packed - either with the two images side by side, or one above the other (top/bottom).
  • decimate is also sometimes referred to as half/half mode. The output frame ends up still being the same size as the original (eg 1920x1080), but the individual images are squashed (2:1) in one dimension to fit them both in (ie each eye would become either 960x1080, or 1920x540, but with non-square pixels).
  • swap_eyes allows putting the image for the right eye on the left/top, and left eye on the right/bottom. Display and H264 generally want swap_eyes=FALSE, JPEG stereoscopic wants swap_eyes=TRUE. NOT IMPLEMENTED YET!
The rules:
  • This is for the compute module only and requires two camera modules (obvious I know!). It is not possible to run it on a standard Pi as only one camera interface is exposed. Please don't ask.
  • You MUST enable stereoscopic mode before enabling the camera component or setting the camera number. Stereoscopic mode needs to take control of both cameras and allocate memory differently (read more!), and those actions occur early on. There is a basic check to try and avoid you enabling stereoscopic too late. You can disable it again after the component has been enabled without issue other than having used more memory/resources than necessary.
  • You will need to instruct TVService to switch your TV into a stereoscopic mode before running your camera command if you want to view the stereoscopic output. For me that is something like

    Code: Select all

     tvservice --explicit="CEA_3D_TB 4"
    tvservice --explicit="CEA_3D_SBS 16"
    tvservice -m CEA will give you a list of the modes your TV supports.
  • The camera number parameter now selects the first channel camera. The second channel is always the other one (seeing as there are only 2 interfaces on this chip)
  • The MMAL port format defines the overall image buffer for both images. I haven't written the userland raspistill/vid code cleanly as yet, but for a full side by side 5MPix JPEG you will want to execute something like raspistill -w 5184 -h 1944 -3d sbs -o stereo.jps.
  • There are definite restrictions to what can be displayed both on putting things on the display, and what the display can then drive. Exact limits aren't established yet (and you may be able to exceed them with overclocking), but 1080P half/half will certainly work as it is almost no extra over normal 1080P. 720P full frame also works.
  • The hardware H264 block has an internal line buffer that will limit you at a maximum of 1920 wide. Please do not exceed that. There is another limitation on the frame height at 1344, so I'm afraid that also means that 720P top/bottom full frame is also out. The width of each image must also be a multiple of 128 (overall width a multiple of 256), so 1920x1080 doesn't work (1920/2 = 960. /128 = 7.5) . raspivid command will be something like raspivid -w 1792 -h 1080 -3d tb -hh -o stereo.264.
    This is NOT MVC encoding, just H264 with the two images squashed into one. My understanding from Dom is that XBMC (and omxplayer) will pick up stereoscopic encoding from the filename if it is correctly formatted for it It looks like file.3DSBS.mp4, file1.HSBS.mp4, file2.3DTAB.mp4, and file3.HTAB.mp4 are the four options, but please check XBMC docs/forums for more info - I am no expert on the playback side.
  • If you ask for an I420 or similar encoding, then you should get a buffer the size of the MMAL port format with the two stereoscopic images packed in the desired format.
  • All the camera settings (AGC, AWB etc) are slaved off the primary sensor. Covering the lens on one sensor will either have no effect (if the primary) or result in the other eye over saturating (if the secondary). This is expected behaviour.
  • This will NOT be supported through V4L2 - the V4L2 API currently doesn't appear to have any calls or parameters relating to stereoscopic video, and I'm not going to be adding them
This code is a little rushed and is quite likely to have a few little gremlins in it. If you have a compute module with two cameras and are able to play about with this, then please do and report any issues (as long as you have obeyed the rules above) on this thread. I still have a little over a week to fix things up, but it would really help if you can give command-lines and/or test programs that demonstrate the issues (I know I haven't done the raspistill/vid mods yet!)

Have fun.

edit Correction that 1920 wide will not work with H264 encode as it is not a multiple of 256.
Last edited by 6by9 on Fri Aug 22, 2014 2:19 pm, edited 2 times in total.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5954
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Stereoscopic camera capture - now implemented.

Wed Aug 20, 2014 3:09 pm

Just for reference, the simple diffs that I've been using to test this are:

Code: Select all

diff --git a/host_applications/linux/apps/raspicam/RaspiStill.c b/host_applications/linux/apps/
index cbc11ec..f37b399 100644
--- a/host_applications/linux/apps/raspicam/RaspiStill.c
+++ b/host_applications/linux/apps/raspicam/RaspiStill.c
@@ -830,6 +830,15 @@ static MMAL_STATUS_T create_camera_component(RASPISTILL_STATE *state)
       goto error;
    }

+   {
+      MMAL_PARAMETER_STEREOSCOPIC_MODE_T stereo =
+          {{MMAL_PARAMETER_STEREOSCOPIC_MODE, sizeof(stereo)},
+          MMAL_STEREOSCOPIC_MODE_SIDE_BY_SIDE, MMAL_TRUE};
+     mmal_port_parameter_set(camera->output[0], &stereo.hdr);
+     mmal_port_parameter_set(camera->output[1], &stereo.hdr);
+     mmal_port_parameter_set(camera->output[2], &stereo.hdr);
+   }
+
    MMAL_PARAMETER_INT32_T camera_num =
       {{MMAL_PARAMETER_CAMERA_NUM, sizeof(camera_num)}, state->cameraNum};

diff --git a/host_applications/linux/apps/raspicam/RaspiStillYUV.c b/host_applications/linux/ap
index 006038e..a87ebb3 100644
--- a/host_applications/linux/apps/raspicam/RaspiStillYUV.c
+++ b/host_applications/linux/apps/raspicam/RaspiStillYUV.c
@@ -630,6 +630,14 @@ static MMAL_STATUS_T create_camera_component(RASPISTILLYUV_STATE *state)
       vcos_log_error("Failed to create camera component");
       goto error;
    }
+   {
+      MMAL_PARAMETER_STEREOSCOPIC_MODE_T stereo =
+          {{MMAL_PARAMETER_STEREOSCOPIC_MODE, sizeof(stereo)},
+          MMAL_STEREOSCOPIC_MODE_TOP_BOTTOM, MMAL_TRUE};
+     mmal_port_parameter_set(camera->output[0], &stereo.hdr);
+     mmal_port_parameter_set(camera->output[1], &stereo.hdr);
+     mmal_port_parameter_set(camera->output[2], &stereo.hdr);
+   }

    MMAL_PARAMETER_INT32_T camera_num =
       {{MMAL_PARAMETER_CAMERA_NUM, sizeof(camera_num)}, state->cameraNum};
diff --git a/host_applications/linux/apps/raspicam/RaspiVid.c b/host_applications/linux/apps/ra
index 97af7c9..753260c 100755
--- a/host_applications/linux/apps/raspicam/RaspiVid.c
+++ b/host_applications/linux/apps/raspicam/RaspiVid.c
@@ -1096,6 +1096,15 @@ static MMAL_STATUS_T create_camera_component(RASPIVID_STATE *state)
       vcos_log_error("Failed to create camera component");
       goto error;
    }
+   {
+      MMAL_PARAMETER_STEREOSCOPIC_MODE_T stereo =
+          {{MMAL_PARAMETER_STEREOSCOPIC_MODE, sizeof(stereo)},
+          MMAL_STEREOSCOPIC_MODE_SIDE_BY_SIDE, MMAL_TRUE};
+     mmal_port_parameter_set(camera->output[0], &stereo.hdr);
+     mmal_port_parameter_set(camera->output[1], &stereo.hdr);
+     mmal_port_parameter_set(camera->output[2], &stereo.hdr);
+   }
+
diff --git a/interface/mmal/mmal_parameters_camera.h b/interface/mmal/mmal_parameters_camera.h
index a47c292..8e2f022 100644
--- a/interface/mmal/mmal_parameters_camera.h
+++ b/interface/mmal/mmal_parameters_camera.h
@@ -130,6 +104,7 @@ enum {
    MMAL_PARAMETER_VIDEO_DENOISE,             /**< Takes a @ref MMAL_PARAMETER_BOOLEAN_T */
    MMAL_PARAMETER_STILLS_DENOISE,            /**< Takes a @ref MMAL_PARAMETER_BOOLEAN_T */
    MMAL_PARAMETER_ANNOTATE,                  /**< Takes a @ref MMAL_PARAMETER_CAMERA_ANNOTATE_
+   MMAL_PARAMETER_STEREOSCOPIC_MODE,         /**< Takes a @ref MMAL_PARAMETER_STEREOSCOPIC_MOD
 };

 /** Thumbnail configuration parameter type */
@@ -718,4 +693,19 @@ typedef struct MMAL_PARAMETER_CAMERA_ANNOTATE_T
    MMAL_BOOL_T show_motion;
 } MMAL_PARAMETER_CAMERA_ANNOTATE_T;

+typedef enum MMAL_STEREOSCOPIC_MODE_T {
+   MMAL_STEREOSCOPIC_MODE_NONE = 0,
+   MMAL_STEREOSCOPIC_MODE_SIDE_BY_SIDE = 1,
+   MMAL_STEREOSCOPIC_MODE_TOP_BOTTOM = 2,
+   MMAL_STEREOSCOPIC_MODE_MAX = 0x7FFFFFFF,
+} MMAL_STEREOSCOPIC_MODE_T;
+
+typedef struct MMAL_PARAMETER_STEREOSCOPIC_MODE_T
+{
+   MMAL_PARAMETER_HEADER_T hdr;
+
+   MMAL_STEREOSCOPIC_MODE_T mode;
+   MMAL_BOOL_T decimate;
+} MMAL_PARAMETER_STEREOSCOPIC_MODE_T;
+
I was fiddling with the parameter structures to test out the combinations.

If playing with not setting decimate in raspistill/YUV, then you will want to tweak host_applications/linux/apps/raspicam/RaspiPreview.c to alter

Code: Select all

   state->previewWindow.width = 1024;
   state->previewWindow.height = 768;
at line 188ish to reflect the aspect ratio of the capture as well. Sorting that properly is one of the holdups in getting it pushed.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

toxibunny
Posts: 1382
Joined: Thu Aug 18, 2011 9:21 pm

Re: Stereoscopic camera capture - now implemented.

Wed Aug 20, 2014 4:30 pm

Cool. Thanks!
note: I may or may not know what I'm talking about...

airvb99
Posts: 7
Joined: Thu Aug 21, 2014 3:06 pm

Re: Stereoscopic camera capture - now implemented.

Thu Aug 21, 2014 9:22 pm

Great great news ! Now I need to order a Pi compute kit !

Is this done entirely (mainly) by the GPU ? Can the output still be streamed instead of being displayed ?
Do you know if mmal API could work with Xenomai kernel instead of the Raspian one ? I need implement some additionnal real time tasks.

Regards,

Herve

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5954
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Stereoscopic camera capture - now implemented.

Fri Aug 22, 2014 7:17 am

airvb99 wrote:Is this done entirely (mainly) by the GPU ? Can the output still be streamed instead of being displayed ?
Totally on the GPU.
Yes, you can still get the same formats of output as before. Just see the notes on the restrictions, particularly for H264.
airvb99 wrote:Do you know if mmal API could work with Xenomai kernel instead of the Raspian one ? I need implement some additionnal real time tasks.
Pass. Raspbian is the only officially supported distro, and I don't know the differences with Xenomai's architecture over standard Linux. If you can port the VCHI and MMAL chunks over then there shouldn't be any major issues, but it's not my area of expertise.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

airvb99
Posts: 7
Joined: Thu Aug 21, 2014 3:06 pm

Re: Stereoscopic camera capture - now implemented.

Fri Aug 22, 2014 9:55 am

Hi 6by9,

Adding Xenomai on the RPi involves recompiling the kernel with some patches. With Xenomai, RPi runs 2 kernels, the realtime one (Xenomai) and the second one (Linux). IRQ handling is done on Xenomai side who dispatch them to Linux when the interrupt has not to be handled by Xenomai and when it doesn't disturb Xenomai. On the Linux kernel's view and the userland Linux area, there is no differences. Some tasks runs in Linux userland, some other in Xenomai userland.
My plan is to run video streaming (and some other secondary tasks) in Linux userland. Video task wil be a light because greatly offloaded by GPU, and run the quadcopter control loop in Xenomai userland (not too heavy with 700 bogomips left !).
If RPi disable mmal if it is not run on a "vanillia RPi" kernel, my scenary won't work. Is there some authenticate signing process on RPi kernel that would disabling mmal capability and ruin my hope adding Xenomai on RPi with full GPU support ?

Regards,

Herve

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Stereoscopic camera capture - now implemented.

Fri Aug 22, 2014 2:46 pm

airvb99 wrote:Is there some authenticate signing process on RPi kernel
Nope, it just runs a bog-standard kernel: http://www.raspberrypi.org/documentatio ... /README.md

And in fact the kernel doesn't have to be Linux, it could also be RISC OS, or one of the BSDs, or Plan9... :)
http://www.raspberrypi.org/open-source-arm-userspace/

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5954
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Stereoscopic camera capture - now implemented.

Fri Aug 22, 2014 5:37 pm

First bug found. H264 side by side encode will currently lock up the GPU. I have pushed a fix, but I don't know when Dom will do the next release. Top/bottom should be OK.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

airvb99
Posts: 7
Joined: Thu Aug 21, 2014 3:06 pm

Re: Stereoscopic camera capture - now implemented.

Mon Aug 25, 2014 3:38 pm

@6by9: Ok, my work is not started, RPi compute has just been ordered and still have to travel the ocean to reach home. Foundation have time to debug the firmware !

Kozuch
Posts: 62
Joined: Sun Aug 10, 2014 10:35 am

Re: Stereoscopic camera capture - now implemented.

Sun Sep 14, 2014 12:50 pm

I am very interested to use the "stereoscopic camera" feature for a computer stereo vision project. I consider getting the Compute Module Development Kit to get started. I have a few questions/things to confirm though:

Is each stereo image pair (stills or video) in perfect frame synchronization? On what level is the frame sync done? Are both cameras fed with an external clock signal to do a "genlock" for frame synchronization or is there only a "soft" frame sync where no HW genlock is being done and it is only being "hoped" to get the best from a common HW setup (board + cameras)?

The frame synchronization is very important to me since I will have a rapidly moving environment in my application...

Thanks for any info in advance!

Kozuch
Posts: 62
Joined: Sun Aug 10, 2014 10:35 am

Re: Stereoscopic camera capture - now implemented.

Sun Sep 14, 2014 1:05 pm

I found a historical post where 6by9 says
... there will be a small amount of drift due to their being independent clocks on the two camera boards.
So this seems no HW genlock is being done (as this purely seems to be a SW solution). My additional question would then be - in which range are the drift values expected to be? Will it be more like micro-second or mili-second range? Since I read the camera module clocks at 25 MHz does this mean that the drift may only be 1/25,000,000 s? I guess an instruction may take more clock cycles so if the drift was in a microsecond range that would still be great for my application.

Kozuch
Posts: 62
Joined: Sun Aug 10, 2014 10:35 am

Re: Stereoscopic camera capture - now implemented.

Sun Sep 28, 2014 8:26 am

Where can I find the release(s) that Dom made?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20946
Joined: Sat Jul 30, 2011 7:41 pm

Re: Stereoscopic camera capture - now implemented.

Sun Sep 28, 2014 11:11 am

It's in the current firmware already. I believe that raspistill/vid were updated as well.

As for genlock, if you connect both cameras to the same crystal, you would get better synchronisation. Requires some soldering though.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5954
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Stereoscopic camera capture - now implemented.

Sun Sep 28, 2014 11:52 am

jamesh wrote:I believe that raspistill/vid were updated as well.
Nope, but the diffs I was testing with are in the second post.
jamesh wrote:As for genlock, if you connect both cameras to the same crystal, you would get better synchronisation. Requires some soldering though.
Correct. The two sensors will be programmed with the same PLL settings, so if they are fed with the same clock then they will stay in sync. There is probably a few ms between the two sensors as they have to be independently told to start streaming, but that shouldn't be a big issue.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

edzieba
Posts: 25
Joined: Fri Jul 29, 2011 6:59 pm

Re: Stereoscopic camera capture - now implemented.

Fri Nov 14, 2014 6:12 pm

Having some trouble getting this running. Cloned the git repo, applied the diff (had to remove the mmal_parameters_camera.h portion as that would not patch, and appears to have already been implemented as a v2?) and ran make.
Running "raspivid -w 1792 -h 1080 -3d tb -hh -o stereo.264" returns "Invalid command line option (-3d)", as does any other raspivid or raspistill command using -3d.
I think I'm missing something fundamental here.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5954
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Stereoscopic camera capture - now implemented.

Fri Nov 14, 2014 7:27 pm

Which repo did you clone?
Having reread the thread I can't see anyone having actually modified Raspistill/vid to take stereoscopic settings on the command-line.
Plus it's easier to run the buildme script which should also do a make install to replace the standard copies of the executables. Without it the executables will just be in the source tree and would have to be specified explicitly.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

edzieba
Posts: 25
Joined: Fri Jul 29, 2011 6:59 pm

Re: Stereoscopic camera capture - now implemented.

Mon Nov 17, 2014 12:46 pm

I cloned git://github.com/raspberrypi/userland.git, modified the code, and used cmake and make to build it. I made sure I was in the /bin subdirectory to make sure I was using the newly built executables.
Not sure what the buildme script is (new to Linux), where would I find it?

gregeric
Posts: 1508
Joined: Mon Nov 28, 2011 10:08 am

Re: Stereoscopic camera capture - now implemented.

Mon Nov 17, 2014 1:50 pm

Even after cd'ing into the build directory, you will need to execute it with ./raspivid which is the correct path to the named file contained in the current directory. Equally, without cd'ing, you could have started it with bin/raspivid

If you don't specify the full path explicitly, linux will look in its default search path only.

edzieba
Posts: 25
Joined: Fri Jul 29, 2011 6:59 pm

Re: Stereoscopic camera capture - now implemented.

Tue Nov 18, 2014 2:16 pm

gregeric wrote:Even after cd'ing into the build directory, you will need to execute it with ./raspivid which is the correct path to the named file contained in the current directory. Equally, without cd'ing, you could have started it with bin/raspivid

If you don't specify the full path explicitly, linux will look in its default search path only.
Thanks! Unfortunately, even running the correct executable still results in "Invalid command line option (-3d)".

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5954
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Stereoscopic camera capture - now implemented.

Tue Nov 18, 2014 3:28 pm

buildme would be the supplied build script in the userland repo (https://github.com/raspberrypi/userland ... er/buildme) and referred to in the project's README
This repository contains the source code for the ARM side libraries used on Raspberry Pi. These typically are installed in /opt/vc/lib and includes source for the ARM side code to interface to: EGL, mmal, GLESv2, vcos, openmaxil, vchiq_arm, bcm_host, WFC, OpenVG.

Use buildme to build. It requires cmake to be installed and an arm cross compiler. It is set up to use this one: https://github.com/raspberrypi/tools/tr ... f-raspbian
Run with

Code: Select all

./buildme
when in the userland directory.
Broadly it wraps make, make install, and installing headers into the standard directories.


The code currently submitted to the userland repo does not include any 3D settings and you haven't given us any ideas as to your changes, yet you want help with why your new option doesn't work! Can I suggest you either post your diffs, or push your data to your own github account?
With a standard build then you are going to get an error when you add -3d to the command line.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

PiGraham
Posts: 3406
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Stereoscopic camera capture - now implemented.

Tue Nov 18, 2014 4:24 pm

6by9 wrote:raspivid command will be something like raspivid -w 1792 -h 1080 -3d tb -hh -o stereo.264

This code is a little rushed and is quite likely to have a few little gremlins in it. If you have a compute module with two cameras and are able to play about with this, then please do and report any issues (as long as you have obeyed the rules above) on this thread. I still have a little over a week to fix things up, but it would really help if you can give command-lines and/or test programs that demonstrate the issues (I know I haven't done the raspistill/vid mods yet!)



Has this confused edzieba ?

The first reference to raspivid might be read as indicating that raspivid works with a -3d parameter.
The last line shows that is not the case.

Confirmed here:

6by9 wrote:
jamesh wrote:I believe that raspistill/vid were updated as well.

Nope, but the diffs I was testing with are in the second post.


and here:

6by9 wrote:The code currently submitted to the userland repo does not include any 3D settings...

.
So to get 3D working apply 6by9's diffs from here http://www.raspberrypi.org/forums/viewt ... 20#p600720
or do your own mods to the source, and compile userland with ./buildme


Sorry if I'm stating the obvious here, or have it wrong, but I had to read twice to get the status straight.
Last edited by PiGraham on Tue Nov 18, 2014 6:35 pm, edited 1 time in total.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5954
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Stereoscopic camera capture - now implemented.

Tue Nov 18, 2014 6:13 pm

PiGraham wrote:So to get 3D working apply 6by9's diffs from here http://www.raspberrypi.org/forums/viewt ... 20#p600720
or do your own mods to the source, and compile userland with ./buildme

Sorry if I'm stating the obvious here, or have it wrong, but I had to read twice to get the status straight.
Good spot. I was wondering where that command line had come from and hadn't realised it was my own post :oops:
In my defence, I had also written:
I haven't written the userland raspistill/vid code cleanly as yet, but for a full side by side 5MPix JPEG you will want to execute something like raspistill -w 5184 -h 1944 -3d sbs -o stereo.jps.
Please note that my diffs will NOT provide those command options. My diffs hard code the stereoscopic mode as I was just testing things. Adding them as options isn't difficult so had been left as an exercise for others whilst I had been looking at firmware issues - no one seems to have stepped up to the plate to do that work.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

PiGraham
Posts: 3406
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Stereoscopic camera capture - now implemented.

Wed Nov 19, 2014 10:11 am

Thanks 6by9.

edzieba
Posts: 25
Joined: Fri Jul 29, 2011 6:59 pm

Re: Stereoscopic camera capture - now implemented.

Wed Nov 19, 2014 4:28 pm

6by9 wrote:Please note that my diffs will NOT provide those command options. My diffs hard code the stereoscopic mode as I was just testing things. Adding them as options isn't difficult so had been left as an exercise for others whilst I had been looking at firmware issues - no one seems to have stepped up to the plate to do that work.
Ah, that's where I'd been going wrong, I though that diffs were to add that option to raspivid/raspistill.
If I'm understanding things correctly, as it stands the only way to produce stereo images or video with the Compute Module is to write a new interface that talks to the (MMAL?) library, pokes the GPU to encode things,, and whatever else is required?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5954
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Stereoscopic camera capture - now implemented.

Wed Nov 19, 2014 5:05 pm

Applying my diffs will make raspivid run in side by side mode, and with decimation due to

Code: Select all

+      MMAL_PARAMETER_STEREOSCOPIC_MODE_T stereo =
+          {{MMAL_PARAMETER_STEREOSCOPIC_MODE, sizeof(stereo)},
+          MMAL_STEREOSCOPIC_MODE_SIDE_BY_SIDE, MMAL_TRUE};
Change the MMAL_STEREOSCOPIC_MODE_SIDE_BY_SIDE to MMAL_STEREOSCOPIC_MODE_TOP_BOTTOM if you want top/bottom, and change the MMAL_TRUE to MMAL_FALSE to disable decimation, but note all my caveats of what is and is not supported.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Camera board”