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

Floating point exception (core dumped) when frame = cap.get_frame_robust() #102

Open
umeiko opened this issue Oct 13, 2024 · 0 comments
Open

Comments

@umeiko
Copy link

umeiko commented Oct 13, 2024

  • ubuntu20.04
  • x86 with Intel cpu
import uvc

print(uvc.device_list())
cap = uvc.Capture(uvc.device_list()[0]["uid"])
controls_dict = dict([(c.display_name, c) for c in cap.controls])
modes = cap.available_modes
mode = modes[1]
cap.frame_mode = mode
print(f"{cap.name} running at {mode}")
frame = cap.get_frame_robust()
print(frame)
(video_venv) umeko@umeko-MC03:~/ws$ gdb python
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.2) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...
(No debugging symbols found in python)
(gdb) run ./test_pyuvc.py 
Starting program: /home/umeko/ws/video_venv/bin/python ./test_pyuvc.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff4230700 (LWP 80989)]
[New Thread 0x7ffff1a2f700 (LWP 80990)]
[New Thread 0x7fffef22e700 (LWP 80991)]
[Thread 0x7fffef22e700 (LWP 80991) exited]
[Thread 0x7ffff1a2f700 (LWP 80990) exited]
[Thread 0x7ffff4230700 (LWP 80989) exited]
[Detaching after fork from child process 80999]
[New Thread 0x7fffef22e700 (LWP 81000)]
[{'name': 'HikCamera', 'manufacturer': 'HIK', 'serialNumber': 'F12357045', 'idProduct': 257, 'idVendor': 11231, 'device_address': 9, 'bus_number': 1, 'uid': '1:9'}]
[Thread 0x7fffef22e700 (LWP 81000) exited]
[New Thread 0x7fffef22e700 (LWP 81002)]
[Thread 0x7fffef22e700 (LWP 81002) exited]
[New Thread 0x7fffef22e700 (LWP 81003)]
[New Thread 0x7ffff1a2f700 (LWP 81004)]
HikCamera running at CameraMode(width=240, height=320, fps=30, format_native=7, format_name='MJPG', supported=True)

Thread 8 "python" received signal SIGFPE, Arithmetic exception.
[Switching to Thread 0x7ffff1a2f700 (LWP 81004)]
0x00007ffff6ee074b in _uvc_populate_frame_ts_us () from /home/umeko/ws/video_venv/lib/python3.8/site-packages/uvc/uvc_bindings.cpython-38-x86_64-linux-gnu.so

but opencv-python can capture the frame normally.

import cv2
import time

cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 240)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 320)
cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*'MJPG'))

def main():
    for i in range(10):
        ret, frame = cap.read()
        cv2.imwrite(f"./{i}.jpg", frame)
        time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant