Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having difficulty with stereo captures using video ports #342

Closed
ggoodchild opened this issue Oct 30, 2016 · 11 comments
Closed

Having difficulty with stereo captures using video ports #342

ggoodchild opened this issue Oct 30, 2016 · 11 comments

Comments

@ggoodchild
Copy link

ggoodchild commented Oct 30, 2016

The following code works as expected provided the "use_video_port=True" parameter is omitted. If it is included as written, then the output file contains the image from one camera and a field of green where the second camera's image should be. What am I doing wrong? (Raspberry Pi Compute module with two cameras)

`import time
import picamera

count = 0
duration = 3
fn = "seq"

cam = picamera.PiCamera(camera_num=0, stereo_mode='side-by-side', stereo_decimate=True, resolution=(1280,480), framerate=30)
cam.start_preview()
time.sleep(2)
start = time.time()

while time.time() - start < duration:
fname = fn + str(count) + '.jpg'
cam.capture(fname, 'jpeg', use_video_port=True)
count = count + 1

`

@6by9
Copy link
Collaborator

6by9 commented Oct 31, 2016

What firmware revision are you on? (vcgencmd version)
Green is all 0 in YUV colourspace, so something's not writing the data correctly.
I had a vague recollection of a fix having gone in for the image copy function not handling multiple channels correctly, but can't see it now.
It'll be a firmware bug rather than PiCamera itself - I'll add it to the list of things to have a look at.

@ggoodchild
Copy link
Author

Thank you for responding.
pi@raspberrypi:~ $ vcgencmd version
May 20 2016 19:05:21
Copyright (c) 2012 Broadcom
version faf071dd4885c5ac1a89483d35a5326e7f69495f (clean) (release)

@6by9
Copy link
Collaborator

6by9 commented Oct 31, 2016

Thanks. Recent enough even if not absolute latest.

@waveform80 Could you confirm for me that with use_video_port=True, camera->output[1] goes to video_splitter->input[0] as OPAQUE, and then video_splitter->output[N] goes to image_encode->input[0] as I420?
I think the issue is that video_splitter isn't handling the multiple image channels correctly (I only fixed up camera, image_encode, video_encode, and video_render for multichannel stuff. Resize is likely to break too).

@6by9
Copy link
Collaborator

6by9 commented Nov 16, 2016

Ping @waveform80 again.
Could you confirm for me that with use_video_port=True, camera->output[1] goes to video_splitter->input[0] as OPAQUE, and then video_splitter->output[N] goes to image_encode->input[0] as I420? It would save me a bit of time in creating a test case (I really don't do Python, and I can't remember the state of my CM anyway)

@waveform80
Copy link
Owner

Sorry, completely forgot about this! Erm, good question - I can't remember exactly what happens as of 1.12 (because it tries to use OPAQUE wherever it possibly can now). I'll have a look what it does this evening.

@waveform80
Copy link
Owner

Yup, it is indeed "camera->output[1] goes to video_splitter->input[0] as OPAQUE, and then video_splitter->output[N] goes to image_encode->input[0] as I420". Incidentally, for anyone that wants to debug this sort of thing I added a little something in 1.11 or thereabouts for debugging this stuff. Just set PiEncoder.DEBUG to True and each time an encoder gets started it'll dump a description of the pipeline from the encoder's output back to the camera:

>>> import picamera
>>> camera = picamera.PiCamera()
>>> picamera.PiEncoder.DEBUG = True
>>> camera.capture('foo.jpg', use_video_port=True)
 vc.ril.camera [1]                                [0] vc.ril.video_splitter [0]                               [0] vc.ril.image_encode [0]       
   encoding    OPQV-dual         -->      OPQV-single       encoding        I420             -->             I420      encoding       JPEG      
      buf      10x128                          10x128          buf          1x3133440                   1x3133440         buf         1x81920   
     frame     1920x1088@30fps         1920x1088@0fps         frame         1920x1088@0fps         1920x1088@0fps        frame        0x0@0fps  

However, I have just discovered the debug stuff's broken under Py3 (doh!) so I'll get that fixed up :)

@6by9
Copy link
Collaborator

6by9 commented Nov 16, 2016

Thank you. I'll look to fix up video_splitter then and hopefully that'll resolve this issue.

@6by9
Copy link
Collaborator

6by9 commented Feb 3, 2017

I have firmware change that fixes this, I just need to get it merged and released into a firmware image (I'd guess early next week)

@ggoodchild
Copy link
Author

ggoodchild commented Feb 3, 2017 via email

popcornmix added a commit to raspberrypi/firmware that referenced this issue Feb 8, 2017
firmware: FXL6408 expander: allow readback of output state

firmware: IL Video_splitter: Handle stereoscopic into buffers
See: waveform80/picamera#342

firmware: IL Image_encode: Correct list of supported formats
See: #733

bootcode: BOOTROM is bit position not a maskable value. BOOTROM_RELEASE_BCM2837_B0_RC3
bootcode: Add USB device boot as standard boot mode
bootcode: Support Pi 1 model B for MSD booting

firmware: i2c_gpio: Disable logging

firmware: Camplus annotate: hold back lines until annotated
See: #701

userland: Add pkg-config file for mmal
See: raspberrypi/userland#374

userland: RaspiStill: Read sensor information correctly if one of each type is attached
See: raspberrypi/userland#373
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this issue Feb 8, 2017
firmware: FXL6408 expander: allow readback of output state

firmware: IL Video_splitter: Handle stereoscopic into buffers
See: waveform80/picamera#342

firmware: IL Image_encode: Correct list of supported formats
See: raspberrypi/firmware#733

bootcode: BOOTROM is bit position not a maskable value. BOOTROM_RELEASE_BCM2837_B0_RC3
bootcode: Add USB device boot as standard boot mode
bootcode: Support Pi 1 model B for MSD booting

firmware: i2c_gpio: Disable logging

firmware: Camplus annotate: hold back lines until annotated
See: raspberrypi/firmware#701

userland: Add pkg-config file for mmal
See: raspberrypi/userland#374

userland: RaspiStill: Read sensor information correctly if one of each type is attached
See: raspberrypi/userland#373
@6by9
Copy link
Collaborator

6by9 commented Feb 8, 2017

Fix released if you do sudo rpi-update.
Don't do this on a critical machine - that is the cutting edge branch so may have issues.

mkreisl added a commit to xbianonpi/xbian-package-firmware that referenced this issue Feb 22, 2017
- firmware: Add usb/net support from next branch

- firmware: Fix usb/net boot issue
  See: Hexxeh/rpi-firmware#134

- firmware: Redo CEC code cleanup Parts 1-10

- firmware: arm_loader: Populate kaslr_seed dt entry
  See: #694

- firmware: raspivid: listen on TCP port for incoming connection
  See: raspberrypi/userland#359

- firmware: dispmanx: Return failure when dispmanx_resource_create fails to allocate image

- firmware: display_server: Avoid overwriting a host allocated resource when an allocation fails
  See: #723

- firmware: vce: Fix unsafe access without lock
- firmware: vce: Remove unwanted vce_release_semaphore when obtain failed

- firmware: hdmi: Use hdmi drive when any hdmi modes are supported
  See: https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=169879

- firmware: di_adv: Fix for green artefacts regression
  See: http://forum.kodi.tv/showthread.php?tid=304573

- firmware: di_adv: Avoid artefacts at bottom of video for YUV420
  See: http://forum.kodi.tv/showthread.php?tid=304814

- firmware: raspistill: Added SIGUSR2 signal to capture and exit immediately
  See: raspberrypi/userland#368

- firmware: dispmanx: Protect a null element access

- firmware: leds: Provide a way of changing LED assignments for CM3

- firmware: leds: Prevent re-initialisation

- firmware: arm_display: Fix limit of aspect ratio of two to one
  See: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=5851&start=475#p1101545

- firmware: raspicam: Fixed dummy error: SIGUSR2 should capture and exit even if verbose is false
  See: raspberrypi/userland#372

- firmware: leds: Allow controlled re-initialisation

- firmware: platform: Always bit-bash the SMPS and GPIO expander

- firmware: i2c_gpio: Remove pointless latch get/put

- firmware: platform: Remove unused/incorrect CEC_OSD_NAME define

- firmware: Fixup CEC code cleanup 8: fixed hdmi state machine clk
  See: #732

- firmware: CEC code cleanup 11: cec_release_logical_addr

- firmware: CEC code cleanup 12: CEC init @ HPD

 firmware: IL image_encode: Add BGR888 support

- firmware: FXL6408 expander: allow readback of output state

- firmware: IL Video_splitter: Handle stereoscopic into buffers
  See: waveform80/picamera#342

- firmware: IL Image_encode: Correct list of supported formats
  See: #733

- firmware: i2c_gpio: Disable logging

- firmware: Camplus annotate: hold back lines until annotated
  See: #701

- firmware: FXL6408/GPIOman: Support config of termination via dt-blob

- firmware: GPIO expander: Add API to reconfigure pins
- firmware: GPIOMAN: Add API to reconfigure pins
- firmware: Mailbox service: Add command to reconfigure GPIO setup
- firmware: FXL6408: Return success code on reading status of an output
- firmware: GPIO expander: Add set/get_config functions to dummy driver
neuschaefer pushed a commit to neuschaefer/raspi-binary-firmware that referenced this issue Feb 27, 2017
firmware: FXL6408 expander: allow readback of output state

firmware: IL Video_splitter: Handle stereoscopic into buffers
See: waveform80/picamera#342

firmware: IL Image_encode: Correct list of supported formats
See: raspberrypi#733

bootcode: BOOTROM is bit position not a maskable value. BOOTROM_RELEASE_BCM2837_B0_RC3
bootcode: Add USB device boot as standard boot mode
bootcode: Support Pi 1 model B for MSD booting

firmware: i2c_gpio: Disable logging

firmware: Camplus annotate: hold back lines until annotated
See: raspberrypi#701

userland: Add pkg-config file for mmal
See: raspberrypi/userland#374

userland: RaspiStill: Read sensor information correctly if one of each type is attached
See: raspberrypi/userland#373
@farzanehnakhaee70
Copy link

Unfortunately my problem has not been solved using rpi-update. what can I do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants