Code Monkey home page Code Monkey logo

Comments (5)

ludusrusso avatar ludusrusso commented on May 30, 2024

Same problem here with web_video_server! Any idea how to fix this?

from raspicam_node.

AKrause4 avatar AKrause4 commented on May 30, 2024

I am also having this issue, hope to hear some kind of fix

from raspicam_node.

elgarbe avatar elgarbe commented on May 30, 2024

me too! any comment?

from raspicam_node.

MoffKalast avatar MoffKalast commented on May 30, 2024

Can confirm this is still a problem.

from raspicam_node.

realizator avatar realizator commented on May 30, 2024

I think I know the source of this problem.

  1. Actually, while capturing RAW data from the sensor, native Pi utilities (like raspividyuv etc) requires width to be dividable by 32, and height to be dividable by 16.
  2. If you capture non-RAW (like using raspivid utility), these utilities do scaling to get final requested resolution, so you didn't notice this issue. Scaling is done by GPU, so performance is the same.

What's going on in your case:

  1. You ask to capture 308x410 resolution
  2. 308/16 = 19.25 (non dividable by 16). Next nearest to 19.25 is 20, so system captures 20x16= 320 instead of 308
  3. 410/32 = 12.8125 (not dividable by 32). Next nearest to 12.8125 is 13, so system captures 13x32 = 416
  4. You actually have 320x416x3 = 399360 bytes of data. Right these numbers are declared here in your first message:
    data: <array type: uint8, length: 399360>

We faced this problem in our stereoscopic OpenCV scripts, and use a couple of approaches here:

  1. Check, if the resolution you set is dividable by 16 (X and Y), and if not - fix it before transmitting these parameters to the capturing part. I.e. in your case try to set 320x416 instead of 308x410.
  2. Keep the resolution you use, but fix the X and Y you expect in output data.

UPD> More details in a PiCamera documentation here: https://picamera.readthedocs.io/en/release-1.13/recipes2.html#capturing-to-a-numpy-array

Cite:
It is also important to note that when outputting to unencoded formats, the camera rounds the requested resolution. The horizontal resolution is rounded up to the nearest multiple of 32 pixels, while the vertical resolution is rounded up to the nearest multiple of 16 pixels. For example, if the requested resolution is 100x100, the capture will actually contain 128x112 pixels worth of data, but pixels beyond 100x100 will be uninitialized.

from raspicam_node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.