Opened 5 years ago

Closed 5 years ago

#3517 closed defect (fixed)

webcam: QVideoFrame size (640,480) does not match expected image size

Reported by: j.r.lewandowski@… Owned by: Tom Goddard
Priority: normal Milestone:
Component: VR Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description (last modified by Eric Pettersen)

The following bug report has been submitted:
Platform:        Darwin-18.7.0-x86_64-i386-64bit
ChimeraX Version: 1.1.dev202007120755 (2020-07-12 07:55:44 UTC)
Description
Tried to screen capure with Microsoft Stream

Log:
UCSF ChimeraX version: 1.1.dev202007120755 (2020-07-12)  
© 2016-2020 Regents of the University of California. All rights reserved.  
How to cite UCSF ChimeraX  

> open /Users/jozef/Desktop/sys2.bild format bild

Opened BILD data containing 5 objects  

> turn z 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x 1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x -1

> turn x 90 90

> turn x 90 900

> turn x 90 45

> turn x 90 3

> turn x 90 3

> turn x 90 3

> turn x 90 3

> turn x 90 3

> turn x 90 3

> turn x 90 10

> close

> open /Users/jozef/Desktop/system2.bild

Opened BILD data containing 3 objects  

> open /Users/jozef/Desktop/arrow2.bild

Opened BILD data containing 1 objects  

> view

> close #2

> open /Users/jozef/Desktop/arrow2.bild

Opened BILD data containing 1 objects  

> close #2

> open /Users/jozef/Desktop/arrow2.bild

Opened BILD data containing 1 objects  

> view

> rest

Unknown command: rest  

> rese

Unknown command: rese  

> reset

Unknown command: reset  

> close #2

> open /Users/jozef/Desktop/arrow2.bild

Opened BILD data containing 1 objects  

> open /Users/jozef/Desktop/arrow2.bild

Opened BILD data containing 1 objects  

> close

> open /Users/jozef/Desktop/system2.bild

Opened BILD data containing 3 objects  

> open /Users/jozef/Desktop/arrow2.bild

Opened BILD data containing 1 objects  
Drag select of 3 shapes  

> webcam true

Web camera "FaceTime HD Camera", width 1280, height 720, framerate 30  
QVideoFrame (1280 by 720, pixel format 1) has wrong number of bytes 3686432,
expected 3686400  

> close #1

> open /Users/jozef/Desktop/system2.bild

Opened BILD data containing 3 objects  

> webcam true flipHorizontal true

> turn z 90 models #2

> turn z 90 models #2

> turn z 90 models #2

> turn z 90 models #2

> turn z 90 models #2 center 0 0 0

Invalid "center" argument: Expected 3 floats or object specifier  

> turn z 90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> set bgColor black

> select up

Nothing selected  

> webcam false

> webcam true flipHorizontal false

Web camera "FaceTime HD Camera", width 1280, height 720, framerate 30  

> webcam true flipHorizontal true

set flip horizontal True  

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> select up

Nothing selected  

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

> turn z -90 models #2 center 0,0,0

Traceback (most recent call last):  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 411, in present  
self._rgba_image = _numpy_rgba_array_from_qt_video_frame(frame,
self._rgba_image)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
  
See log for complete Python traceback.  
  
Traceback (most recent call last):  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 411, in present  
self._rgba_image = _numpy_rgba_array_from_qt_video_frame(frame,
self._rgba_image)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
  
See log for complete Python traceback.  
  
Traceback (most recent call last):  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 411, in present  
self._rgba_image = _numpy_rgba_array_from_qt_video_frame(frame,
self._rgba_image)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
  
See log for complete Python traceback.  
  
Traceback (most recent call last):  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 411, in present  
self._rgba_image = _numpy_rgba_array_from_qt_video_frame(frame,
self._rgba_image)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
  
See log for complete Python traceback.  
  
Traceback (most recent call last):  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 411, in present  
self._rgba_image = _numpy_rgba_array_from_qt_video_frame(frame,
self._rgba_image)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
  
See log for complete Python traceback.  
  
Traceback (most recent call last):  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 411, in present  
self._rgba_image = _numpy_rgba_array_from_qt_video_frame(frame,
self._rgba_image)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
  
See log for complete Python traceback.  
  
Traceback (most recent call last):  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 411, in present  
self._rgba_image = _numpy_rgba_array_from_qt_video_frame(frame,
self._rgba_image)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
  
See log for complete Python traceback.  
  

[_many_ of these deleted]

See log for complete Python traceback.  
  
Traceback (most recent call last):  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 411, in present  
self._rgba_image = _numpy_rgba_array_from_qt_video_frame(frame,
self._rgba_image)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
ValueError: QVideoFrame size (640,480) does not match expected image size
(1280,720)  
  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/webcam/webcam.py", line 446, in
_numpy_rgba_array_from_qt_video_frame  
% (w, h, iw, ih))  
  
See log for complete Python traceback.  
  




OpenGL version: 4.1 NVIDIA-12.0.24 355.11.10.50.10.103
OpenGL renderer: NVIDIA GeForce GT 750M OpenGL Engine
OpenGL vendor: NVIDIA CorporationHardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro11,3
      Processor Name: Intel Core i7
      Processor Speed: 2.5 GHz
      Number of Processors: 1
      Total Number of Cores: 4
      L2 Cache (per Core): 256 KB
      L3 Cache: 6 MB
      Hyper-Threading Technology: Enabled
      Memory: 16 GB
      Boot ROM Version: 151.0.0.0.0
      SMC Version (system): 2.19f12

Software:

    System Software Overview:

      System Version: macOS 10.14.6 (18G5033)
      Kernel Version: Darwin 18.7.0
      Time since boot: 2 days 3:09

Graphics/Displays:

    Intel Iris Pro:

      Chipset Model: Intel Iris Pro
      Type: GPU
      Bus: Built-In
      VRAM (Dynamic, Max): 1536 MB
      Vendor: Intel
      Device ID: 0x0d26
      Revision ID: 0x0008
      Automatic Graphics Switching: Supported
      gMux Version: 4.0.8 [3.2.8]
      Metal: Supported, feature set macOS GPUFamily1 v4

    NVIDIA GeForce GT 750M:

      Chipset Model: NVIDIA GeForce GT 750M
      Type: GPU
      Bus: PCIe
      PCIe Lane Width: x8
      VRAM (Total): 2 GB
      Vendor: NVIDIA (0x10de)
      Device ID: 0x0fe9
      Revision ID: 0x00a2
      ROM Revision: 3776
      Automatic Graphics Switching: Supported
      gMux Version: 4.0.8 [3.2.8]
      Metal: Supported, feature set macOS GPUFamily1 v4
      Displays:
        Color LCD:
          Display Type: Built-In Retina LCD
          Resolution: 2880 x 1800 Retina
          Framebuffer Depth: 24-Bit Color (ARGB8888)
          Main Display: Yes
          Mirror: Off
          Online: Yes
          Rotation: Supported
          Automatically Adjust Brightness: No

PyQt version: 5.12.3
Compiled Qt version: 5.12.4
Runtime Qt version: 5.12.9

Change History (5)

comment:1 by Eric Pettersen, 5 years ago

Component: UnassignedVR
Description: modified (diff)
Owner: set to Tom Goddard
Platform: all
Project: ChimeraX
Status: newassigned
Summary: ChimeraX bug report submissionwebcam: QVideoFrame size (640,480) does not match expected image size

Reported by Jozef Lewandowski

comment:2 by Tom Goddard, 5 years ago

I suspect what happened here is ChimeraX was happily using 1280 x 720 video frames from your Mac laptop webcam. Then you turned on Microsoft Stream and it grabbed the webcam and switched it to 640 x 480 resolution. ChimeraX is not expecting some other app might change the camera resolution while ChimeraX is using the camera. I can probably make it handle that by accepting whatever resolution it gets.

I have never used Microsoft Stream. Perhaps you can tell it not to use the web cam since your webcam image will come through the ChimeraX window.

comment:3 by Tom Goddard, 5 years ago

Another trick to make ChimeraX webcam work with Microsoft Stream would be to tell ChimeraX to use 640 x 480 resolution. Unfortunately I don't have that webcam option yet, you can only ask for a framerate. But I can probably add such an option.

in reply to:  4 ; comment:4 by J.R.Lewandowski@…, 5 years ago

Thank you, Tom. It is not crucial. I was just trying with MS Stream but there are other tools that work.
I think that getting other camera formats working as you mentioned in the SBGrid talk is more important (that was awesome!).
Thanks,
Józef
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Wednesday, July 15, 2020 7:44 PM
Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; Lewandowski, Jozef <J.R.Lewandowski@warwick.ac.uk>
Subject: Re: [ChimeraX] #3517: webcam: QVideoFrame size (640, 480) does not match expected image size

#3517: webcam: QVideoFrame size (640,480) does not match expected image size
----------------------------------------+-------------------------
          Reporter:  j.r.lewandowski@…  |      Owner:  Tom Goddard
              Type:  defect             |     Status:  assigned
          Priority:  normal             |  Milestone:
         Component:  VR                 |    Version:
        Resolution:                     |   Keywords:
        Blocked By:                     |   Blocking:
Notify when closed:                     |   Platform:  all
           Project:  ChimeraX           |
----------------------------------------+-------------------------

Comment (by Tom Goddard):

 Another trick to make ChimeraX webcam work with Microsoft Stream would be
 to tell ChimeraX to use 640 x 480 resolution.  Unfortunately I don't have
 that webcam option yet, you can only ask for a framerate.  But I can
 probably add such an option.

--
Ticket URL: <https://plato.cgl.ucsf.edu/trac/ChimeraX/ticket/3517#comment:3>
ChimeraX <http://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker

comment:5 by Tom Goddard, 5 years ago

Resolution: fixed
Status: assignedclosed

Fixed.

I made the webcam handle the case when the camera changes the size of the video frames mid-stream. Also I added a webcam size option (e.g. webcam on size 640,480) to allow you to choose the desired resolution.

Note: See TracTickets for help on using tickets.