NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Logitech HD Pro Webcam C920 USB webcam resolution



El 25/2/25 a las 20:24, Joel escribió:
On 2/25/2025 11:06, Ramiro Aceves wrote:
Hello,
I am having trouble to get proper pictures and videos from it.

with:

$ffmpeg7 -f v4l2 -i /dev/video0 -vframes 1 output.jpg

I get a very dark picture.

with:

ffmpeg7 -f v4l2 -i /dev/video0 -vframes 5  output_%02d.jpg


Not sure if this helps, but I've had issues using OpenCV as well. It seems there's an issue with an ioctl call when changing camera settings. In my case, I can't use OpenCV to change the resolution from the default.

I ended up making a couple changes for my camera as a workaround to at least get full resolution.

Also, I have to "warm" the camera auto brightness before taking a final image.

Here's my OpenCV git diff:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fa409f516c..c05da68e82 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,10 @@
  #
 # ----------------------------------------------------------------------------

+# BSD
+add_compile_options($<$<COMPILE_LANGUAGE:C>:-std=gnu17>)
+add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=gnu++20>)
+
  # Disable in-source builds to prevent source tree corruption.
  if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
    message(FATAL_ERROR "
@@ -129,7 +133,7 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)  # https://cmake.org/cmake/help/
      if(WIN32)
       set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory" FORCE)
      else()
-      set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation Directory" FORCE) +      set(CMAKE_INSTALL_PREFIX "/usr/pkg" CACHE PATH "Installation Directory" FORCE)
      endif()
    else()
      # any cross-compiling
diff --git a/modules/videoio/src/cap_v4l.cpp b/modules/videoio/src/ cap_v4l.cpp
index 2fc41ce05e..2af652597d 100644
--- a/modules/videoio/src/cap_v4l.cpp
+++ b/modules/videoio/src/cap_v4l.cpp
@@ -222,6 +222,14 @@ make & enjoy!
  #include <stdlib.h>
  #include <sys/stat.h>
  #include <sys/ioctl.h>
+#include <inttypes.h>
+#include <stdint.h>
+#ifndef __u32
+#define __u32 uint32_t
+#endif
+#ifndef __s32
+#define __s32 int32_t
+#endif
  #include <limits>

  #include <poll.h>
@@ -276,8 +284,8 @@ typedef uint32_t __u32;
  #endif

 /* Defaults - If your board can do better, set it here.  Set for the most common type inputs. */
-#define DEFAULT_V4L_WIDTH  640
-#define DEFAULT_V4L_HEIGHT 480
+#define DEFAULT_V4L_WIDTH  1280
+#define DEFAULT_V4L_HEIGHT 720
  #define DEFAULT_V4L_FPS 30


Hello Joel,

I have been trying to use graphics/opencv package from pkgsrc 2024Q4 using python3.12 but it seems that rapsberrypi4 CPU does not have NEON neither FP16 required features:


netbsd-raspa4$ python3.12
Python 3.12.8 (main, Jan 10 2025, 00:27:43) [GCC 10.5.0] on netbsd10
Type "help", "copyright", "credits" or "license" for more information.

>>> import cv2

******************************************************************
* FATAL ERROR:                                                   *
* This OpenCV build doesn't support current CPU/HW configuration *
*                                                                *
* Use OPENCV_DUMP_CONFIG=1 environment variable for details      *
******************************************************************

Required baseline features:
    ID=100 (NEON) - NOT AVAILABLE
    ID=  9 (FP16) - NOT AVAILABLE
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(3.4.20) /pbulk/work/graphics/opencv/work/opencv-3.4.20/modules/core/src/system.cpp:706: error: (-215:Assertion failed) Missing support for required CPU baseline features. Check OpenCV build configuration and required CPU/HW setup. in function 'initialize'

[1]   Abort trap (core dumped) python3.12




I am not sure how to disable them.



netbsd-raspa4$ export OPENCV_DUMP_CONFIG=1
netbsd-raspa4$ python3.12
Python 3.12.8 (main, Jan 10 2025, 00:27:43) [GCC 10.5.0] on netbsd10
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2

OpenCV build configuration is:

General configuration for OpenCV 3.4.20 =====================================
  Version control:               unknown

  Platform:
    Timestamp:                   2025-01-10T01:14:46Z
    Host:                        NetBSD 10.0 aarch64
    CMake:                       3.31.1
    CMake generator:             Unix Makefiles
CMake build tool: /pbulk/work/graphics/opencv/work/.tools/bin/gmake
    Configuration:               Release

  CPU/HW features:
    Baseline:                    NEON FP16

  C/C++:
    Built as dynamic libs?:      YES
    C++11:                       YES
C++ Compiler: /pbulk/work/graphics/opencv/work/.cwrapper/bin/c++ (ver 10.5.0) C++ flags (Release): -O2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/python3.12 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/X11R7/include -I/usr/pkg/include/freetype2 -I/usr/pkg/include/harfbuzz -I/usr/X11R7/include/libdrm -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -DNDEBUG -DNDEBUG C++ flags (Debug): -O2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/python3.12 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/X11R7/include -I/usr/pkg/include/freetype2 -I/usr/pkg/include/harfbuzz -I/usr/X11R7/include/libdrm -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -DDEBUG -D_DEBUG C Compiler: /pbulk/work/graphics/opencv/work/.cwrapper/bin/gcc C flags (Release): -O2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/python3.12 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/X11R7/include -I/usr/pkg/include/freetype2 -I/usr/pkg/include/harfbuzz -I/usr/X11R7/include/libdrm -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -DNDEBUG -DNDEBUG C flags (Debug): -O2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/python3.12 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/X11R7/include -I/usr/pkg/include/freetype2 -I/usr/pkg/include/harfbuzz -I/usr/X11R7/include/libdrm -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -g -DDEBUG -D_DEBUG Linker flags (Release): -Wl,-zrelro -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined Linker flags (Debug): -Wl,-zrelro -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
    ccache:                      NO
    Precompiled headers:         NO
    Extra dependencies:          m pthread
    3rdparty dependencies:

  OpenCV modules:
To be built: calib3d core dnn features2d flann highgui imgcodecs imgproc ml objdetect photo python3 shape stitching superres ts video videoio videostab
    Disabled:                    world
    Disabled by dependency:      -
Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 viz
    Applications:                tests perf_tests apps
    Documentation:               NO
    Non-free algorithms:         NO

  GUI:
    GTK+:                        YES (ver 3.24.43)
      GThread :                  YES (ver 2.82.2)
      GtkGlExt:                  NO
    VTK support:                 NO

  Media I/O:
    ZLib:                        /usr/lib/libz.so (ver 1.2.13)
    JPEG:                        /usr/pkg/lib/libjpeg.so (ver 90)
WEBP: /usr/pkg/lib/libwebp.so (ver encoder: 0x020f)
    PNG:                         /usr/pkg/lib/libpng16.so (ver 1.6.44)
    TIFF:                        /usr/pkg/lib/libtiff.so (ver 42 / 4.7.0)
    OpenEXR:                     OpenEXR::OpenEXR (ver 3.3.2)
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES

  Video I/O:
    DC1394:                      NO
    GStreamer:                   NO
    libv4l/libv4l2:              NO
    v4l/v4l2:                    sys/videoio.h

  Parallel framework:            pthreads

  Trace:                         YES (with Intel ITT)

  Other third-party libraries:
    Lapack:                      YES (cblas lapacke blas lapack)
    Custom HAL:                  YES (carotene (ver 0.0.1))
Protobuf: /pbulk/work/graphics/opencv/work/.buildlink/lib/libprotobuf.so.28.3.0 (28.3.0)

  OpenCL:                        YES (no extra features)
Include path: /pbulk/work/graphics/opencv/work/opencv-3.4.20/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python 3:
    Interpreter:                 /usr/pkg/bin/python3.12 (ver 3.12.8)
    Libraries:                   /usr/pkg/lib/libpython3.12.so (ver 3.12.8)
numpy: /usr/pkg/lib/python3.12/site-packages/numpy/_core/include (ver 2.1.3) install path: lib/python3.12/site-packages/cv2/python-3.12

  Python (for build):            /usr/pkg/bin/python3.12

  Install to:                    /usr/pkg
-----------------------------------------------------------------



******************************************************************
* FATAL ERROR:                                                   *
* This OpenCV build doesn't support current CPU/HW configuration *
*                                                                *
* Use OPENCV_DUMP_CONFIG=1 environment variable for details      *
******************************************************************

Required baseline features:
    ID=100 (NEON) - NOT AVAILABLE
    ID=  9 (FP16) - NOT AVAILABLE
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(3.4.20) /pbulk/work/graphics/opencv/work/opencv-3.4.20/modules/core/src/system.cpp:706: error: (-215:Assertion failed) Missing support for required CPU baseline features. Check OpenCV build configuration and required CPU/HW setup. in function 'initialize'

[1]   Abort trap (core dumped) python3.12
netbsd-raspa4$

I do not figure how to overcome it, it surpasses me :-)

CPU/HW features:
    Baseline:                    NEON FP16

How to disable them for compile opencv again?

Thanks.
Regards.



Home | Main Index | Thread Index | Old Index