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

picamera.array bytes_to_rgb(data, resolution) is broken when splitter is in use (typo) #321

Closed
reillyardstard opened this issue Sep 4, 2016 · 1 comment
Assignees
Labels
Milestone

Comments

@reillyardstard
Copy link

@reillyardstard reillyardstard commented Sep 4, 2016

typo in the assignment when a splitter is in use (line 110):

    fwidth, fheith = raw_resolution(resolution, splitter=True)
def bytes_to_rgb(data, resolution):
    """
    Converts a bytes objects containing RGB/BGR data to a `numpy`_ array.
    """
    width, height = resolution
    fwidth, fheight = raw_resolution(resolution)
    # Workaround: output from the video splitter is rounded to 16x16 instead
    # of 32x16 (but only for RGB, and only when a resizer is not used)
    if len(data) != (fwidth * fheight * 3):
        fwidth, fheith = raw_resolution(resolution, splitter=True)
        if len(data) != (fwidth * fheight * 3):
            raise PiCameraValueError(
                'Incorrect buffer length for resolution %dx%d' % (width, height))
    # Crop to the actual resolution
    return np.frombuffer(data, dtype=np.uint8).\
            reshape((fheight, fwidth, 3))[:height, :width, :]
@waveform80
Copy link
Owner

@waveform80 waveform80 commented Sep 4, 2016

Doh, yup - that's a bug.

@waveform80 waveform80 added the bug label Sep 4, 2016
@waveform80 waveform80 self-assigned this Sep 4, 2016
@waveform80 waveform80 added this to the 1.13 milestone Sep 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants