Notification time stamped 2022-10-22 13:58:50 UTC
From 937f2cc1d577682de3cc37d558c48ee859585772 Mon Sep 17 00:00:00 2001 From: Rich Mattes richmattes@gmail.com Date: May 26 2018 21:08:04 +0000 Subject: Re-enable OpenCV bindings (rhbz#1551748)
Fix bogus obsoletes (rhbz#1537213) Update udev rule to allow device access to "video" group
---
diff --git a/0001-Build-libfreenect_cv-and-cvdemo-as-C-sources.patch b/0001-Build-libfreenect_cv-and-cvdemo-as-C-sources.patch new file mode 100644 index 0000000..73e9583 --- /dev/null +++ b/0001-Build-libfreenect_cv-and-cvdemo-as-C-sources.patch @@ -0,0 +1,66 @@ +From 9e98a0b11fddeabab6ef5e0915b96c950597e53e Mon Sep 17 00:00:00 2001 +From: Rich Mattes richmattes@gmail.com +Date: Sat, 26 May 2018 16:11:11 -0400 +Subject: [PATCH 1/2] Build libfreenect_cv and cvdemo as C++ sources + +Signed-off-by: Rich Mattes richmattes@gmail.com +--- + wrappers/opencv/CMakeLists.txt | 4 ++-- + wrappers/opencv/{cvdemo.c => cvdemo.cpp} | 0 + wrappers/opencv/{libfreenect_cv.c => libfreenect_cv.cpp} | 0 + wrappers/opencv/libfreenect_cv.h | 4 ++-- + 4 files changed, 4 insertions(+), 4 deletions(-) + rename wrappers/opencv/{cvdemo.c => cvdemo.cpp} (100%) + rename wrappers/opencv/{libfreenect_cv.c => libfreenect_cv.cpp} (100%) + +diff --git a/wrappers/opencv/CMakeLists.txt b/wrappers/opencv/CMakeLists.txt +index 0239075..bc5df19 100644 +--- a/wrappers/opencv/CMakeLists.txt ++++ b/wrappers/opencv/CMakeLists.txt +@@ -2,7 +2,7 @@ + # OpenCV Interface + ###################################################################################### + find_package(OpenCV REQUIRED) +-add_library (freenect_cv SHARED libfreenect_cv.c) ++add_library (freenect_cv SHARED libfreenect_cv.cpp) + set_target_properties (freenect_cv PROPERTIES + VERSION ${PROJECT_VER} + SOVERSION ${PROJECT_APIVER}) +@@ -16,7 +16,7 @@ install (TARGETS freenect_cv + install (FILES "libfreenect_cv.h" + DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR}) + +-add_executable(freenect-cvdemo cvdemo.c) ++add_executable(freenect-cvdemo cvdemo.cpp) + target_link_libraries(freenect-cvdemo freenect freenect_sync freenect_cv ${OpenCV_LIBS}) + install (TARGETS freenect-cvdemo + DESTINATION bin) +diff --git a/wrappers/opencv/cvdemo.c b/wrappers/opencv/cvdemo.cpp +similarity index 100% +rename from wrappers/opencv/cvdemo.c +rename to wrappers/opencv/cvdemo.cpp +diff --git a/wrappers/opencv/libfreenect_cv.c b/wrappers/opencv/libfreenect_cv.cpp +similarity index 100% +rename from wrappers/opencv/libfreenect_cv.c +rename to wrappers/opencv/libfreenect_cv.cpp +diff --git a/wrappers/opencv/libfreenect_cv.h b/wrappers/opencv/libfreenect_cv.h +index b73b60c..55e3582 100644 +--- a/wrappers/opencv/libfreenect_cv.h ++++ b/wrappers/opencv/libfreenect_cv.h +@@ -1,11 +1,11 @@ + #pragma once + ++#include <opencv/cv.h> ++ + #ifdef __cplusplus + extern "C" { + #endif + +-#include <opencv/cv.h> +- + IplImage *freenect_sync_get_depth_cv(int index); + IplImage *freenect_sync_get_rgb_cv(int index); + +-- +2.17.0 + diff --git a/0002-Fix-bugs-in-sync-library-error-handling.patch b/0002-Fix-bugs-in-sync-library-error-handling.patch new file mode 100644 index 0000000..f437b6b --- /dev/null +++ b/0002-Fix-bugs-in-sync-library-error-handling.patch @@ -0,0 +1,51 @@ +From db0e1825ff93133f3ca5735524d78279ede824db Mon Sep 17 00:00:00 2001 +From: Rich Mattes richmattes@gmail.com +Date: Sat, 26 May 2018 16:14:01 -0400 +Subject: [PATCH 2/2] Fix bugs in sync library error handling + +fnusb_open_subdevices checked for camera==NULL or res < 0 before +jumping to the failure case. If camera was NULL but res was not +0, the function would return 0 indicating success. This occurs +when a kinect is not plugged into the PC. Forcing res to be +negative when the camera == NULL case allows the failure to open +a device to propagate through an application. + +alloc_kinect in freenect_sync has a check for if freenect_open_device +fails, but the logic is incorrect. freenect_open_device returns 0 on +success and < 0 on error, so adding a check to see if the return is +< 0 corrects detection of the failure case. + +Signed-off-by: Rich Mattes richmattes@gmail.com +--- + src/usb_libusb10.c | 1 + + wrappers/c_sync/libfreenect_sync.c | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/usb_libusb10.c b/src/usb_libusb10.c +index 11de86a..614aeee 100644 +--- a/src/usb_libusb10.c ++++ b/src/usb_libusb10.c +@@ -465,6 +465,7 @@ FN_INTERNAL int fnusb_open_subdevices(freenect_device *dev, int index) + } + + if (res < 0 || camera == NULL) { ++ res = -1; + goto failure; + } + +diff --git a/wrappers/c_sync/libfreenect_sync.c b/wrappers/c_sync/libfreenect_sync.c +index 1b2e049..26a2261 100644 +--- a/wrappers/c_sync/libfreenect_sync.c ++++ b/wrappers/c_sync/libfreenect_sync.c +@@ -249,7 +249,7 @@ static int change_depth_format(sync_kinect_t *kinect, freenect_resolution res, f + static sync_kinect_t *alloc_kinect(int index) + { + sync_kinect_t *kinect = (sync_kinect_t*)malloc(sizeof(sync_kinect_t)); +- if (freenect_open_device(ctx, &kinect->dev, index)) { ++ if (freenect_open_device(ctx, &kinect->dev, index) < 0) { + free(kinect); + return NULL; + } +-- +2.17.0 + diff --git a/libfreenect.spec b/libfreenect.spec index d5e3e5d..62b7556 100644 --- a/libfreenect.spec +++ b/libfreenect.spec @@ -8,7 +8,7 @@
Name: libfreenect Version: 0.5.7 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Device driver for the Kinect # Core libfreenect is available as ASL 2.0 OR GPLv2 # OpenNI driver is available as ASL 2.0 @@ -16,6 +16,8 @@ License: ASL 2.0 and (GPLv2 or ASL 2.0) URL: http://www.openkinect.org/
Source0: https://github.com/OpenKinect/%%7Bname%7D/archive/%%7Bcommit%7D/%%7Bname%7D-... +# Edit udev rule to only allow access to the device from the video group +Patch0: %{name}-0.5.7-videogroup.patch # Freenect openni driver is a plugin lib, and doesn't need soversion symlinks Patch1: %{name}-0.4.1-openni2.patch # Allow for proper libdir @@ -24,6 +26,10 @@ Patch3: %{name}-0.4.2-libdir.patch Patch4: secarch.patch # Fix the installation path for python libs Patch7: %{name}-0.5.5-py3.patch +# Fixes to OpenCV support +# https://github.com/OpenKinect/libfreenect/pull/555 +Patch8: 0001-Build-libfreenect_cv-and-cvdemo-as-C-sources.patch +Patch9: 0002-Fix-bugs-in-sync-library-error-handling.patch
BuildRequires: cmake BuildRequires: Cython @@ -33,21 +39,12 @@ BuildRequires: libusb1-devel BuildRequires: libGL-devel BuildRequires: libXi-devel BuildRequires: libXmu-devel -# FTBFS with opencv 3.4.1: -# https://bugzilla.redhat.com/show_bug.cgi?id=1551748 -#BuildRequires: opencv-devel +BuildRequires: opencv-devel BuildRequires: python2-devel BuildRequires: python2-numpy BuildRequires: python3-devel BuildRequires: python3-numpy
-# We had to disable build of OpenCV bindings when OpenCV went to -# 3.4.1: https://bugzilla.redhat.com/show_bug.cgi?id=1551748 -# This is to make updates work for systems which have the package -# installed. The version should *not* be bumped, if we ever get the -# bindings building again, we don't want newer versions obsoleted -Obsoletes: %{name}-opencv < 0.5.7 - Requires: udev
%description @@ -82,15 +79,13 @@ and a library that can be linked to, providing an interface compatible with freenect. This allows you to save data and repeat for experiments, debug problems, share datasets, and experiment with the kinect without having one.
-# FTBFS with opencv 3.4.1: -# https://bugzilla.redhat.com/show_bug.cgi?id=1551748 -#package opencv -#Summary: OpenCV bindings for %{name} -#Requires: %{name}%{?_isa} = %{version}-%{release} +%package opencv +Summary: OpenCV bindings for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release}
-#description opencv -#The %{name}-opencv package contains the libfreenect binding -#library for OpenCV development. +%description opencv +The %{name}-opencv package contains the libfreenect binding +library for OpenCV development.
%package -n python2-%{name} Summary: Python 2 bindings for %{name} @@ -98,7 +93,7 @@ Requires: %{name}%{?_isa} = %{version}-%{release} Requires: python2-numpy # Until F28 Provides: %{name}-python%{?_isa} = %{version}-%{release} -Obsoletes: %{name}-python%{?_isa} < 0.5.5 +Obsoletes: %{name}-python < 0.5.5 %{?python_provide:%python_provide python2-%{name}}
%description -n python2-%{name} @@ -125,10 +120,13 @@ It was originally a separate project but is now distributed with libfreenect. %setup -qn %{name}-%{commit} rm -rf platform/windows
+%patch0 -p0 -b .videogroup %patch1 -p0 -b .openni2 %patch3 -p0 -b .libdir %patch4 -p1 -b .secarch %patch7 -p1 -b .py3 +%patch8 -p1 +%patch9 -p1
%build mkdir build @@ -138,7 +136,7 @@ pushd build %cmake .. \ -DBUILD_AUDIO=ON \ -DBUILD_C_SYNC=ON \ - -DBUILD_CV=OFF \ + -DBUILD_CV=ON \ -DBUILD_REDIST_PACKAGE=ON \ -DBUILD_EXAMPLES=ON \ -DBUILD_FAKENECT=ON \ @@ -175,11 +173,9 @@ mv %{buildroot}%{_libdir}/OpenNI2-FreenectDriver %{buildroot}%{_libdir}/openni2/
%postun -p /sbin/ldconfig
-# FTBFS with opencv 3.4.1: -# https://bugzilla.redhat.com/show_bug.cgi?id=1551748 -#post opencv -p /sbin/ldconfig +%post opencv -p /sbin/ldconfig
-#postun opencv -p /sbin/ldconfig +%postun opencv -p /sbin/ldconfig
%files %license APACHE20 GPL2 @@ -192,11 +188,9 @@ mv %{buildroot}%{_libdir}/OpenNI2-FreenectDriver %{buildroot}%{_libdir}/openni2/ %{_bindir}/freenect-* %{_datadir}/%{name}
-# FTBFS with opencv 3.4.1: -# https://bugzilla.redhat.com/show_bug.cgi?id=1551748 -#files opencv -#{_bindir}/freenect-cvdemo -#{_libdir}/libfreenect_cv.so.* +%files opencv +%{_bindir}/freenect-cvdemo +%{_libdir}/libfreenect_cv.so.*
%files devel %doc doc/html @@ -226,6 +220,11 @@ mv %{buildroot}%{_libdir}/OpenNI2-FreenectDriver %{buildroot}%{_libdir}/openni2/ %{_libdir}/openni2
%changelog +* Sat May 26 2018 Rich Mattes richmattes@gmail.com - 0.5.7-2 +- Re-enable OpenCV bindings (rhbz#1551748) +- Fix bogus obsoletes (rhbz#1537213) +- Update udev rule to allow device access to "video" group + * Mon Mar 05 2018 Adam Williamson awilliam@redhat.com - 0.5.7-1 - Bump to 0.5.7 (bug fixes) - Disable openCV support for now (see #1551748)
https://src.fedoraproject.org/rpms/libfreenect/c/937f2cc1d577682de3cc37d558c...
scm-commits@lists.fedoraproject.org