pkgsrc-WIP-changes archive

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

opencv*: add upgrade candidates



Module Name:	pkgsrc-wip
Committed By:	Thomas Klausner <wiz%gatalith.at@localhost>
Pushed By:	wiz
Date:		Thu Mar 16 15:25:43 2023 +0100
Changeset:	afec405be364115ccb4faeecb2cb292c55cc5a22

Modified Files:
	Makefile
Added Files:
	opencv-contrib-face/DESCR
	opencv-contrib-face/Makefile
	opencv-contrib-face/PLIST
	opencv-contrib-face/TODO
	opencv-contrib-face/buildlink3.mk
	opencv-contrib-face/distinfo
	opencv/DESCR
	opencv/Makefile
	opencv/Makefile.common
	opencv/PLIST
	opencv/buildlink3.mk
	opencv/distinfo
	opencv/hacks.mk
	opencv/options.mk
	opencv/patches/patch-3rdparty_ippicv_ippicv.cmake
	opencv/patches/patch-3rdparty_protobuf_src_google_protobuf_message__lite.cc
	opencv/patches/patch-CMakeLists.txt
	opencv/patches/patch-apps_visualisation_opencv__visualisation.cpp
	opencv/patches/patch-cmake_OpenCVDetectCXXCompiler.cmake
	opencv/patches/patch-cmake_OpenCVDetectPython.cmake
	opencv/patches/patch-cmake_OpenCVFindOpenEXR.cmake
	opencv/patches/patch-cmake_checks_lapack__check.cpp
	opencv/patches/patch-modules_core_include_opencv2_core_bindings__utils.hpp
	opencv/patches/patch-modules_core_include_opencv2_core_opencl_opencl__info.hpp
	opencv/patches/patch-modules_core_include_opencv2_core_types_c.h
	opencv/patches/patch-modules_core_src_check.cpp
	opencv/patches/patch-modules_core_src_downhill__simplex.cpp
	opencv/patches/patch-modules_core_src_rand.cpp
	opencv/patches/patch-modules_core_src_system.cpp
	opencv/patches/patch-modules_dnn_src_layers_accum__layer.cpp
	opencv/patches/patch-modules_dnn_src_tensorflow_tf__importer.cpp
	opencv/patches/patch-modules_dnn_src_torch_torch__importer.cpp
	opencv/patches/patch-modules_dnn_test_test__precomp.hpp
	opencv/patches/patch-modules_flann_include_opencv2_flann_defines.h
	opencv/patches/patch-modules_imgproc_src_resize.cpp
	opencv/patches/patch-modules_ts_src_ts.cpp
	opencv/patches/patch-modules_videoio_src_cap__v4l.cpp

Log Message:
opencv*: add upgrade candidates

opencv-contrib-face is incomplete

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=afec405be364115ccb4faeecb2cb292c55cc5a22

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                                           |   2 +
 opencv-contrib-face/DESCR                          |   1 +
 opencv-contrib-face/Makefile                       |  79 ++++
 opencv-contrib-face/PLIST                          |  29 ++
 opencv-contrib-face/TODO                           |  16 +
 opencv-contrib-face/buildlink3.mk                  |  15 +
 opencv-contrib-face/distinfo                       |  31 ++
 opencv/DESCR                                       |  12 +
 opencv/Makefile                                    |  40 ++
 opencv/Makefile.common                             |  56 +++
 opencv/PLIST                                       | 437 +++++++++++++++++++++
 opencv/buildlink3.mk                               |  29 ++
 opencv/distinfo                                    |  28 ++
 opencv/hacks.mk                                    |  19 +
 opencv/options.mk                                  |  41 ++
 opencv/patches/patch-3rdparty_ippicv_ippicv.cmake  |  12 +
 ...y_protobuf_src_google_protobuf_message__lite.cc |  14 +
 opencv/patches/patch-CMakeLists.txt                |  65 +++
 ...ch-apps_visualisation_opencv__visualisation.cpp |  12 +
 .../patch-cmake_OpenCVDetectCXXCompiler.cmake      |  17 +
 .../patches/patch-cmake_OpenCVDetectPython.cmake   |  20 +
 opencv/patches/patch-cmake_OpenCVFindOpenEXR.cmake |  21 +
 .../patches/patch-cmake_checks_lapack__check.cpp   |  20 +
 ...s_core_include_opencv2_core_bindings__utils.hpp |  12 +
 ...re_include_opencv2_core_opencl_opencl__info.hpp |  12 +
 ...tch-modules_core_include_opencv2_core_types_c.h |  15 +
 opencv/patches/patch-modules_core_src_check.cpp    |  12 +
 .../patch-modules_core_src_downhill__simplex.cpp   |  16 +
 opencv/patches/patch-modules_core_src_rand.cpp     |  19 +
 opencv/patches/patch-modules_core_src_system.cpp   |  12 +
 .../patch-modules_dnn_src_layers_accum__layer.cpp  |  14 +
 ...tch-modules_dnn_src_tensorflow_tf__importer.cpp |  12 +
 ...patch-modules_dnn_src_torch_torch__importer.cpp |  12 +
 .../patch-modules_dnn_test_test__precomp.hpp       |  20 +
 ...h-modules_flann_include_opencv2_flann_defines.h |  16 +
 .../patches/patch-modules_imgproc_src_resize.cpp   |  24 ++
 opencv/patches/patch-modules_ts_src_ts.cpp         |  33 ++
 .../patches/patch-modules_videoio_src_cap__v4l.cpp | 181 +++++++++
 38 files changed, 1426 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index 0cf63fccf5..b8d8320f27 100644
--- a/Makefile
+++ b/Makefile
@@ -2690,6 +2690,8 @@ SUBDIR+=	opencl-clhpp
 SUBDIR+=	opencl-headers
 SUBDIR+=	openclonk
 SUBDIR+=	openconnect
+SUBDIR+=	opencv
+SUBDIR+=	opencv-contrib-face
 SUBDIR+=	opendchub
 SUBDIR+=	opendune
 SUBDIR+=	openerp-server
diff --git a/opencv-contrib-face/DESCR b/opencv-contrib-face/DESCR
new file mode 100644
index 0000000000..73e991fb92
--- /dev/null
+++ b/opencv-contrib-face/DESCR
@@ -0,0 +1 @@
+OpenCV face recognition contributed module.
diff --git a/opencv-contrib-face/Makefile b/opencv-contrib-face/Makefile
new file mode 100644
index 0000000000..3ce3103c2a
--- /dev/null
+++ b/opencv-contrib-face/Makefile
@@ -0,0 +1,79 @@
+# $NetBSD: Makefile,v 1.25 2023/01/03 17:36:26 wiz Exp $
+
+.include "../../wip/opencv/Makefile.common"
+
+DISTNAME=	opencv_contrib-${OPENCV_VERSION}
+PKGNAME=	${DISTNAME:S/_contrib/-contrib-face/}
+GITHUB_PROJECT=	opencv_contrib
+
+MAINTAINER=	markd%NetBSD.org@localhost
+COMMENT=	OpenCV face recognition contributed module
+
+DISTFILES=	${DEFAULT_DISTFILES} opencv-${PKGVERSION_NOREV}${EXTRACT_SUFX}
+
+INSTALL_DIRS=	build/modules/face build/modules/plot build/modules/tracking
+
+WRKSRC=		${WRKDIR}/opencv-${PKGVERSION_NOREV}
+
+CMAKE_ARGS+=	-DBUILD_DOCS=OFF
+CMAKE_ARGS+=	-DWITH_FFMPEG=OFF
+CMAKE_ARGS+=	-DWITH_JASPER=OFF
+
+CMAKE_ARGS+=		-DOPENCV_EXTRA_MODULES_PATH=${WRKDIR}/${DISTNAME}/modules
+CMAKE_ARGS+=		-DBUILD_opencv_adas=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_bgsegm=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_bioinspired=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_ccalib=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_contrib_world=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_cvv=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_datasets=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_dnn_objdetect=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_hdf=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_hfs=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_img_hash=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_latentsvm=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_line_descriptor=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_matlab=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_optflow=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_reg=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_rgbd=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_saliency=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_surface_matching=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_text=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_xfeatures2d=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_ximgproc=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_xobjdetect=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_xphoto=OFF
+
+CMAKE_ARGS+=		-DBUILD_opencv_dnn=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_flann=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_highgui=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_ml=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_python2=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_python3=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_stitching=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_superres=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_ts=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_videoio=OFF
+CMAKE_ARGS+=		-DBUILD_opencv_videostab=OFF
+
+# At least as of 3.4.6, these are dependencies of the 'face' module
+# and need to be built and installed ('photo' and 'video' are
+# part of the main opencv package already
+#CMAKE_ARGS+=		-DBUILD_opencv_calib3d=OFF
+#CMAKE_ARGS+=		-DBUILD_opencv_features2d=OFF
+#CMAKE_ARGS+=		-DBUILD_opencv_photo=OFF
+#CMAKE_ARGS+=		-DBUILD_opencv_plot=OFF
+#CMAKE_ARGS+=		-DBUILD_opencv_tracking=OFF
+#CMAKE_ARGS+=		-DBUILD_opencv_video=OFF
+
+# direct patch difficult due to partial merge with opencv package
+SUBST_CLASSES+=		stereo
+SUBST_FILES.stereo+=	../opencv_contrib-4.7.0/modules/stereo/CMakeLists.txt
+SUBST_SED.stereo+=	-e "s/ocv_define_module(stereo/ocv_define_module(stereo opencv_calib3d/"
+SUBST_STAGE.stereo=	pre-configure
+SUBST_MESSAGE.stereo=	Add missing library dependency.
+
+BUILDLINK_API_DEPENDS.opencv+=	opencv>=${PKGVERSION_NOREV}
+.include "../../wip/opencv/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/opencv-contrib-face/PLIST b/opencv-contrib-face/PLIST
new file mode 100644
index 0000000000..25db5972b5
--- /dev/null
+++ b/opencv-contrib-face/PLIST
@@ -0,0 +1,29 @@
+@comment $NetBSD: PLIST,v 1.6 2019/04/24 19:34:45 adam Exp $
+include/opencv2/face.hpp
+include/opencv2/face/bif.hpp
+include/opencv2/face/face_alignment.hpp
+include/opencv2/face/facemark.hpp
+include/opencv2/face/facemarkAAM.hpp
+include/opencv2/face/facemarkLBF.hpp
+include/opencv2/face/facemark_train.hpp
+include/opencv2/face/facerec.hpp
+include/opencv2/face/mace.hpp
+include/opencv2/face/predict_collector.hpp
+include/opencv2/plot.hpp
+include/opencv2/tracking.hpp
+include/opencv2/tracking/feature.hpp
+include/opencv2/tracking/kalman_filters.hpp
+include/opencv2/tracking/onlineBoosting.hpp
+include/opencv2/tracking/onlineMIL.hpp
+include/opencv2/tracking/tldDataset.hpp
+include/opencv2/tracking/tracker.hpp
+include/opencv2/tracking/tracking.hpp
+lib/libopencv_face.so
+lib/libopencv_face.so.${PKGVERSION}
+lib/libopencv_face.so.3.4
+lib/libopencv_plot.so
+lib/libopencv_plot.so.${PKGVERSION}
+lib/libopencv_plot.so.3.4
+lib/libopencv_tracking.so
+lib/libopencv_tracking.so.${PKGVERSION}
+lib/libopencv_tracking.so.3.4
diff --git a/opencv-contrib-face/TODO b/opencv-contrib-face/TODO
new file mode 100644
index 0000000000..5e65113c9a
--- /dev/null
+++ b/opencv-contrib-face/TODO
@@ -0,0 +1,16 @@
+- packages, but installs too many files
+- face plugin is not built
+- face plugin wants to download a file, see opencv_contrib-4.7.0/modules/face/CMakeLists.txt:
+
+ocv_download(
+    FILENAME face_landmark_model.dat
+    HASH ${__file_hash}
+    URL
+      "${OPENCV_FACE_ALIGNMENT_URL}"
+      "$ENV{OPENCV_FACE_ALIGNMENT_URL}"
+      "https://raw.githubusercontent.com/opencv/opencv_3rdparty/${__commit_hash}/";
+    DESTINATION_DIR "${CMAKE_BINARY_DIR}/${OPENCV_TEST_DATA_INSTALL_PATH}/cv/face/"
+    ID "data"
+    RELATIVE_URL
+    STATUS res
+)
diff --git a/opencv-contrib-face/buildlink3.mk b/opencv-contrib-face/buildlink3.mk
new file mode 100644
index 0000000000..e4ca1947d0
--- /dev/null
+++ b/opencv-contrib-face/buildlink3.mk
@@ -0,0 +1,15 @@
+# $NetBSD: buildlink3.mk,v 1.7 2023/01/03 17:36:26 wiz Exp $
+
+BUILDLINK_TREE+=	opencv-contrib-face
+
+.if !defined(OPENCV_CONTRIB_FACE_BUILDLINK3_MK)
+OPENCV_CONTRIB_FACE_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.opencv-contrib-face+=	opencv-contrib-face>=3.0.0
+BUILDLINK_ABI_DEPENDS.opencv-contrib-face?=	opencv-contrib-face>=3.4.16nb4
+BUILDLINK_PKGSRCDIR.opencv-contrib-face?=	../../wip/opencv-contrib-face
+
+.include "../../wip/opencv/buildlink3.mk"
+.endif	# OPENCV_CONTRIB_FACE_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-opencv-contrib-face
diff --git a/opencv-contrib-face/distinfo b/opencv-contrib-face/distinfo
new file mode 100644
index 0000000000..d509f115d7
--- /dev/null
+++ b/opencv-contrib-face/distinfo
@@ -0,0 +1,31 @@
+$NetBSD: distinfo,v 1.26 2021/11/15 17:49:44 wiz Exp $
+
+BLAKE2s (opencv-4.7.0.tar.gz) = a534cd707402cb06c9e75a6ed7df67744ec2b5ccbd498c44a692da5fd728ca9e
+SHA512 (opencv-4.7.0.tar.gz) = f799e1eb4ef1eb81212319cf908d0a64d2d5179c8da86b919b06e96a6870a9f3ed33251223a841b71711349018ea6782c174179fa59958a1573e22d11cc9347d
+Size (opencv-4.7.0.tar.gz) = 91027497 bytes
+BLAKE2s (opencv_contrib-4.7.0.tar.gz) = 9d4503697d6cc90bb26fa3ba8da8906be3603cfe2ac5e1535ac3b2c66ec6af4e
+SHA512 (opencv_contrib-4.7.0.tar.gz) = f0d878180655de4255cb72cf358a5949dfcf53a386e74f9a743902ac1bae12b2e812a1fc4ecc56a6afdc6adbffec867883a3245ce0b527614cc76e3710e23230
+Size (opencv_contrib-4.7.0.tar.gz) = 59421940 bytes
+SHA1 (patch-3rdparty_ippicv_ippicv.cmake) = 14ce5de382084793ace32f43c6dfaf01f7ffb390
+SHA1 (patch-3rdparty_protobuf_src_google_protobuf_message__lite.cc) = 821799845336a2cf767f77a8e38512ddc4b0a0af
+SHA1 (patch-CMakeLists.txt) = 534ad3b8834d76f1318e97ccecdc17c9d932c455
+SHA1 (patch-apps_visualisation_opencv__visualisation.cpp) = b62c32172049c6369fd62a5c72325eef995fd1d0
+SHA1 (patch-cmake_OpenCVDetectCXXCompiler.cmake) = ac7deccedcc5071d3785c7827a06419713ba0529
+SHA1 (patch-cmake_OpenCVDetectPython.cmake) = 4f3bfe574edf083ebc7e78d347355c58461b2c6b
+SHA1 (patch-cmake_OpenCVFindOpenEXR.cmake) = 2e3835545ef7b3c174dffc618fea32d6eac792c4
+SHA1 (patch-cmake_checks_lapack__check.cpp) = dd25d34fff25e0d46651789cf5577391d7b48c81
+SHA1 (patch-modules_core_include_opencv2_core_bindings__utils.hpp) = 44a8602670141b2a3bc90c5e1c23a8e7f96a1d40
+SHA1 (patch-modules_core_include_opencv2_core_opencl_opencl__info.hpp) = f0cff24b2a760086f54ab66536bdfee4f4f1a6d7
+SHA1 (patch-modules_core_include_opencv2_core_types_c.h) = 75444e65677be99af8167f9060419d7970a7adaa
+SHA1 (patch-modules_core_src_check.cpp) = c8dac4e0fb6fa4a0dca6a2794bd598ba114e78b6
+SHA1 (patch-modules_core_src_downhill__simplex.cpp) = 1ad7c2fa126d15050b87785e8eec20dbe796b471
+SHA1 (patch-modules_core_src_rand.cpp) = 0ff4f01eaee2ee67536d8721b37506daf2231f10
+SHA1 (patch-modules_core_src_system.cpp) = 972533f71b024ac852af321d2e030f67dc960eed
+SHA1 (patch-modules_dnn_src_layers_accum__layer.cpp) = 20a12489f7e7fcbc90d47871f12ac500ab8ae6ed
+SHA1 (patch-modules_dnn_src_tensorflow_tf__importer.cpp) = 9b3628d91c2217c4b1ed77413efd4c0bf85758c4
+SHA1 (patch-modules_dnn_src_torch_torch__importer.cpp) = 814a3cc929569b691d01e34252dbd185f31161c2
+SHA1 (patch-modules_dnn_test_test__precomp.hpp) = 9bf15d32394f36b92e5fc5d57fd576b3860233ae
+SHA1 (patch-modules_flann_include_opencv2_flann_defines.h) = ab848e67c4e03219670598ac2d21071a617a5c33
+SHA1 (patch-modules_imgproc_src_resize.cpp) = e842d5960c4c00162a34f46cb45cf69d0e9f21ce
+SHA1 (patch-modules_ts_src_ts.cpp) = b9a3992014b02dbd89d46375a2476385e91dc24c
+SHA1 (patch-modules_videoio_src_cap__v4l.cpp) = e2b57da448f48298c108a1158bc8accc88070c94
diff --git a/opencv/DESCR b/opencv/DESCR
new file mode 100644
index 0000000000..f3eb010f00
--- /dev/null
+++ b/opencv/DESCR
@@ -0,0 +1,12 @@
+OpenCV means Intel(R) Open Source Computer Vision Library. It is a
+collection of C functions and a few C++ classes that implement many
+popular Image Processing and Computer Vision algorithms.
+
+OpenCV provides cross-platform middle-to-high level API that includes
+about 300 C functions and a few C++ classes. Also there are Python
+bindings to OpenCV. OpenCV has no strict dependencies on external
+libraries, though it can use some (such as libjpeg, ffmpeg, GTK+ etc.)
+
+OpenCV provides transparent interface to Intel(R) Integrated Performance
+Primitives (IPP). That is, it loads automatically IPP libraries optimized
+for specific processor at runtime, if they are available.
diff --git a/opencv/Makefile b/opencv/Makefile
new file mode 100644
index 0000000000..b997c0b7b6
--- /dev/null
+++ b/opencv/Makefile
@@ -0,0 +1,40 @@
+# $NetBSD: Makefile,v 1.111 2023/01/29 21:16:41 ryoon Exp $
+
+.include "Makefile.common"
+
+DISTNAME=	opencv-${OPENCV_VERSION}
+
+MAINTAINER=	anthony.mallet%laas.fr@localhost
+COMMENT=	Library for computer vision problems
+
+INSTALLATION_DIRS+=	share/doc/opencv/papers
+INSTALLATION_DIRS+=	share/doc/opencv/ref/pics
+INSTALLATION_DIRS+=	share/OpenCV/haarcascades
+
+PKGCONFIG_OVERRIDE+=		build/unix-install/opencv.pc
+PKGCONFIG_OVERRIDE_STAGE=	post-configure
+
+PY_PATCHPLIST=		yes
+REPLACE_PYTHON+=	samples/python/*.py
+
+# includes configure output and paths to gmake etc.
+CHECK_WRKREF_SKIP=	${PREFIX}/lib/libopencv_core.*
+
+.include "options.mk"
+
+TEST_ENV+=	LD_LIBRARY_PATH=${WRKSRC}/build/lib
+TEST_TARGET=	test
+
+post-install:
+	${MV} ${DESTDIR}${PREFIX}/share/licenses/opencv4 ${DESTDIR}${PREFIX}/share/opencv4/licenses
+
+.include "../../devel/protobuf/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../graphics/libwebp/buildlink3.mk"
+.include "../../graphics/openexr/buildlink3.mk"
+.include "../../graphics/png/buildlink3.mk"
+.include "../../graphics/tiff/buildlink3.mk"
+.include "../../lang/python/extension.mk"
+.include "../../math/py-numpy/buildlink3.mk"
+.include "../../mk/jpeg.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/opencv/Makefile.common b/opencv/Makefile.common
new file mode 100644
index 0000000000..ea9d71c7b1
--- /dev/null
+++ b/opencv/Makefile.common
@@ -0,0 +1,56 @@
+# $NetBSD: Makefile.common,v 1.16 2022/12/01 13:39:03 jperkin Exp $
+# used by wip/opencv/Makefile
+# used by wip/opencv-contrib-face/Makefile
+#
+# DO NOT FORGET to regen wip/opencv-contrib-face/distinfo!
+
+OPENCV_VERSION=	4.7.0
+
+CATEGORIES=	graphics devel
+MASTER_SITES=	${MASTER_SITE_GITHUB:=opencv/}
+
+HOMEPAGE=	https://opencv.org/
+LICENSE=	modified-bsd
+
+PATCHDIR=	${.CURDIR}/../../wip/opencv/patches
+
+USE_LANGUAGES=		c c++11
+USE_PKGLOCALEDIR=	yes
+USE_TOOLS+=		gmake pkg-config
+CONFIGURE_ENV+=		MACHINE_ARCH=${MACHINE_ARCH}
+
+CHECK_PORTABILITY_SKIP+=	platforms/ios/cmake/Toolchains/xcodebuild_wrapper.in
+CHECK_PORTABILITY_SKIP+=	cmake/templates/xcode-*
+
+CMAKE_ARGS+=		-DBUILD_JAVA=OFF
+CMAKE_ARGS+=		-DBUILD_PROTOBUF=OFF
+CMAKE_ARGS+=		-DCV_ENABLE_INTRINSICS=OFF # XXX: problematic
+CMAKE_ARGS+=		-DENABLE_CCACHE=OFF
+CMAKE_ARGS+=		-DOPENCV_GENERATE_SETUPVARS=OFF
+CMAKE_ARGS+=		-DPROTOBUF_UPDATE_FILES=ON
+CMAKE_ARGS+=		-DWITH_EIGEN=OFF
+CMAKE_ARGS+=		-DZLIB_ROOT=${BUILDLINK_PREFIX.zlib}
+# doesn't build on NetBSD with libva-2.17.0
+CMAKE_ARGS+=		-DWITH_VA=OFF
+#.include "../../multimedia/libva/buildlink3.mk"
+CMAKE_ARGS.SunOS+=	-DENABLE_PRECOMPILED_HEADERS=OFF
+CMAKE_ARGS.SunOS+=	-DOPENCV_PYTHON_SKIP_LINKER_EXCLUDE_LIBS=ON
+
+BUILDLINK_TRANSFORM+=	rm:-Werror=address
+BUILDLINK_TRANSFORM+=	rm:-Werror=non-virtual-dtor
+
+BUILDLINK_TRANSFORM.SunOS+=	rm:-Wl,--as-needed
+BUILDLINK_TRANSFORM.SunOS+=	rm:-Wl,--gc-sections
+
+.include "../../mk/bsd.prefs.mk"
+
+.if ${MACHINE_ARCH} == "i386"
+# Disable SSE/SSE2 to avoid build errors from missing _mm_pause.
+CMAKE_ARGS+=		-DCPU_BASELINE=""
+.endif
+
+PYTHON_VERSIONS_INCOMPATIBLE=	27
+
+.include "../../mk/atomic64.mk"
+.include "../../lang/python/pyversion.mk"
+.include "../../devel/cmake/build.mk"
diff --git a/opencv/PLIST b/opencv/PLIST
new file mode 100644
index 0000000000..78ddbf362e
--- /dev/null
+++ b/opencv/PLIST
@@ -0,0 +1,437 @@
+@comment $NetBSD$
+bin/opencv_annotation
+bin/opencv_interactive-calibration
+bin/opencv_model_diagnostics
+bin/opencv_version
+bin/opencv_visualisation
+include/opencv4/opencv2/calib3d.hpp
+include/opencv4/opencv2/calib3d/calib3d.hpp
+include/opencv4/opencv2/calib3d/calib3d_c.h
+include/opencv4/opencv2/core.hpp
+include/opencv4/opencv2/core/affine.hpp
+include/opencv4/opencv2/core/async.hpp
+include/opencv4/opencv2/core/base.hpp
+include/opencv4/opencv2/core/bindings_utils.hpp
+include/opencv4/opencv2/core/bufferpool.hpp
+include/opencv4/opencv2/core/check.hpp
+include/opencv4/opencv2/core/core.hpp
+include/opencv4/opencv2/core/core_c.h
+include/opencv4/opencv2/core/cuda.hpp
+include/opencv4/opencv2/core/cuda.inl.hpp
+include/opencv4/opencv2/core/cuda/block.hpp
+include/opencv4/opencv2/core/cuda/border_interpolate.hpp
+include/opencv4/opencv2/core/cuda/color.hpp
+include/opencv4/opencv2/core/cuda/common.hpp
+include/opencv4/opencv2/core/cuda/datamov_utils.hpp
+include/opencv4/opencv2/core/cuda/detail/color_detail.hpp
+include/opencv4/opencv2/core/cuda/detail/reduce.hpp
+include/opencv4/opencv2/core/cuda/detail/reduce_key_val.hpp
+include/opencv4/opencv2/core/cuda/detail/transform_detail.hpp
+include/opencv4/opencv2/core/cuda/detail/type_traits_detail.hpp
+include/opencv4/opencv2/core/cuda/detail/vec_distance_detail.hpp
+include/opencv4/opencv2/core/cuda/dynamic_smem.hpp
+include/opencv4/opencv2/core/cuda/emulation.hpp
+include/opencv4/opencv2/core/cuda/filters.hpp
+include/opencv4/opencv2/core/cuda/funcattrib.hpp
+include/opencv4/opencv2/core/cuda/functional.hpp
+include/opencv4/opencv2/core/cuda/limits.hpp
+include/opencv4/opencv2/core/cuda/reduce.hpp
+include/opencv4/opencv2/core/cuda/saturate_cast.hpp
+include/opencv4/opencv2/core/cuda/scan.hpp
+include/opencv4/opencv2/core/cuda/simd_functions.hpp
+include/opencv4/opencv2/core/cuda/transform.hpp
+include/opencv4/opencv2/core/cuda/type_traits.hpp
+include/opencv4/opencv2/core/cuda/utility.hpp
+include/opencv4/opencv2/core/cuda/vec_distance.hpp
+include/opencv4/opencv2/core/cuda/vec_math.hpp
+include/opencv4/opencv2/core/cuda/vec_traits.hpp
+include/opencv4/opencv2/core/cuda/warp.hpp
+include/opencv4/opencv2/core/cuda/warp_reduce.hpp
+include/opencv4/opencv2/core/cuda/warp_shuffle.hpp
+include/opencv4/opencv2/core/cuda_stream_accessor.hpp
+include/opencv4/opencv2/core/cuda_types.hpp
+include/opencv4/opencv2/core/cv_cpu_dispatch.h
+include/opencv4/opencv2/core/cv_cpu_helper.h
+include/opencv4/opencv2/core/cvdef.h
+include/opencv4/opencv2/core/cvstd.hpp
+include/opencv4/opencv2/core/cvstd.inl.hpp
+include/opencv4/opencv2/core/cvstd_wrapper.hpp
+include/opencv4/opencv2/core/detail/async_promise.hpp
+include/opencv4/opencv2/core/detail/dispatch_helper.impl.hpp
+include/opencv4/opencv2/core/detail/exception_ptr.hpp
+include/opencv4/opencv2/core/directx.hpp
+include/opencv4/opencv2/core/dualquaternion.hpp
+include/opencv4/opencv2/core/dualquaternion.inl.hpp
+include/opencv4/opencv2/core/eigen.hpp
+include/opencv4/opencv2/core/fast_math.hpp
+include/opencv4/opencv2/core/hal/hal.hpp
+include/opencv4/opencv2/core/hal/interface.h
+include/opencv4/opencv2/core/hal/intrin.hpp
+include/opencv4/opencv2/core/hal/intrin_avx.hpp
+include/opencv4/opencv2/core/hal/intrin_avx512.hpp
+include/opencv4/opencv2/core/hal/intrin_cpp.hpp
+include/opencv4/opencv2/core/hal/intrin_forward.hpp
+include/opencv4/opencv2/core/hal/intrin_lasx.hpp
+include/opencv4/opencv2/core/hal/intrin_msa.hpp
+include/opencv4/opencv2/core/hal/intrin_neon.hpp
+include/opencv4/opencv2/core/hal/intrin_rvv.hpp
+include/opencv4/opencv2/core/hal/intrin_rvv071.hpp
+include/opencv4/opencv2/core/hal/intrin_rvv_scalable.hpp
+include/opencv4/opencv2/core/hal/intrin_sse.hpp
+include/opencv4/opencv2/core/hal/intrin_sse_em.hpp
+include/opencv4/opencv2/core/hal/intrin_vsx.hpp
+include/opencv4/opencv2/core/hal/intrin_wasm.hpp
+include/opencv4/opencv2/core/hal/msa_macros.h
+include/opencv4/opencv2/core/hal/simd_utils.impl.hpp
+include/opencv4/opencv2/core/mat.hpp
+include/opencv4/opencv2/core/mat.inl.hpp
+include/opencv4/opencv2/core/matx.hpp
+include/opencv4/opencv2/core/neon_utils.hpp
+include/opencv4/opencv2/core/ocl.hpp
+include/opencv4/opencv2/core/ocl_genbase.hpp
+include/opencv4/opencv2/core/opencl/ocl_defs.hpp
+include/opencv4/opencv2/core/opencl/opencl_info.hpp
+include/opencv4/opencv2/core/opencl/opencl_svm.hpp
+include/opencv4/opencv2/core/opencl/runtime/autogenerated/opencl_clblas.hpp
+include/opencv4/opencv2/core/opencl/runtime/autogenerated/opencl_clfft.hpp
+include/opencv4/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp
+include/opencv4/opencv2/core/opencl/runtime/autogenerated/opencl_core_wrappers.hpp
+include/opencv4/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp
+include/opencv4/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp
+include/opencv4/opencv2/core/opencl/runtime/opencl_clblas.hpp
+include/opencv4/opencv2/core/opencl/runtime/opencl_clfft.hpp
+include/opencv4/opencv2/core/opencl/runtime/opencl_core.hpp
+include/opencv4/opencv2/core/opencl/runtime/opencl_core_wrappers.hpp
+include/opencv4/opencv2/core/opencl/runtime/opencl_gl.hpp
+include/opencv4/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp
+include/opencv4/opencv2/core/opencl/runtime/opencl_svm_20.hpp
+include/opencv4/opencv2/core/opencl/runtime/opencl_svm_definitions.hpp
+include/opencv4/opencv2/core/opencl/runtime/opencl_svm_hsa_extension.hpp
+include/opencv4/opencv2/core/opengl.hpp
+include/opencv4/opencv2/core/operations.hpp
+include/opencv4/opencv2/core/optim.hpp
+include/opencv4/opencv2/core/ovx.hpp
+include/opencv4/opencv2/core/parallel/backend/parallel_for.openmp.hpp
+include/opencv4/opencv2/core/parallel/backend/parallel_for.tbb.hpp
+include/opencv4/opencv2/core/parallel/parallel_backend.hpp
+include/opencv4/opencv2/core/persistence.hpp
+include/opencv4/opencv2/core/quaternion.hpp
+include/opencv4/opencv2/core/quaternion.inl.hpp
+include/opencv4/opencv2/core/saturate.hpp
+include/opencv4/opencv2/core/simd_intrinsics.hpp
+include/opencv4/opencv2/core/softfloat.hpp
+include/opencv4/opencv2/core/sse_utils.hpp
+include/opencv4/opencv2/core/traits.hpp
+include/opencv4/opencv2/core/types.hpp
+include/opencv4/opencv2/core/types_c.h
+include/opencv4/opencv2/core/utility.hpp
+include/opencv4/opencv2/core/utils/allocator_stats.hpp
+include/opencv4/opencv2/core/utils/allocator_stats.impl.hpp
+include/opencv4/opencv2/core/utils/filesystem.hpp
+include/opencv4/opencv2/core/utils/fp_control_utils.hpp
+include/opencv4/opencv2/core/utils/instrumentation.hpp
+include/opencv4/opencv2/core/utils/logger.defines.hpp
+include/opencv4/opencv2/core/utils/logger.hpp
+include/opencv4/opencv2/core/utils/logtag.hpp
+include/opencv4/opencv2/core/utils/tls.hpp
+include/opencv4/opencv2/core/utils/trace.hpp
+include/opencv4/opencv2/core/va_intel.hpp
+include/opencv4/opencv2/core/version.hpp
+include/opencv4/opencv2/core/vsx_utils.hpp
+include/opencv4/opencv2/cvconfig.h
+include/opencv4/opencv2/dnn.hpp
+include/opencv4/opencv2/dnn/all_layers.hpp
+include/opencv4/opencv2/dnn/dict.hpp
+include/opencv4/opencv2/dnn/dnn.hpp
+include/opencv4/opencv2/dnn/dnn.inl.hpp
+include/opencv4/opencv2/dnn/layer.details.hpp
+include/opencv4/opencv2/dnn/layer.hpp
+include/opencv4/opencv2/dnn/shape_utils.hpp
+include/opencv4/opencv2/dnn/utils/debug_utils.hpp
+include/opencv4/opencv2/dnn/utils/inference_engine.hpp
+include/opencv4/opencv2/dnn/version.hpp
+include/opencv4/opencv2/features2d.hpp
+include/opencv4/opencv2/features2d/features2d.hpp
+include/opencv4/opencv2/features2d/hal/interface.h
+include/opencv4/opencv2/flann.hpp
+include/opencv4/opencv2/flann/all_indices.h
+include/opencv4/opencv2/flann/allocator.h
+include/opencv4/opencv2/flann/any.h
+include/opencv4/opencv2/flann/autotuned_index.h
+include/opencv4/opencv2/flann/composite_index.h
+include/opencv4/opencv2/flann/config.h
+include/opencv4/opencv2/flann/defines.h
+include/opencv4/opencv2/flann/dist.h
+include/opencv4/opencv2/flann/dummy.h
+include/opencv4/opencv2/flann/dynamic_bitset.h
+include/opencv4/opencv2/flann/flann.hpp
+include/opencv4/opencv2/flann/flann_base.hpp
+include/opencv4/opencv2/flann/general.h
+include/opencv4/opencv2/flann/ground_truth.h
+include/opencv4/opencv2/flann/hdf5.h
+include/opencv4/opencv2/flann/heap.h
+include/opencv4/opencv2/flann/hierarchical_clustering_index.h
+include/opencv4/opencv2/flann/index_testing.h
+include/opencv4/opencv2/flann/kdtree_index.h
+include/opencv4/opencv2/flann/kdtree_single_index.h
+include/opencv4/opencv2/flann/kmeans_index.h
+include/opencv4/opencv2/flann/linear_index.h
+include/opencv4/opencv2/flann/logger.h
+include/opencv4/opencv2/flann/lsh_index.h
+include/opencv4/opencv2/flann/lsh_table.h
+include/opencv4/opencv2/flann/matrix.h
+include/opencv4/opencv2/flann/miniflann.hpp
+include/opencv4/opencv2/flann/nn_index.h
+include/opencv4/opencv2/flann/object_factory.h
+include/opencv4/opencv2/flann/params.h
+include/opencv4/opencv2/flann/random.h
+include/opencv4/opencv2/flann/result_set.h
+include/opencv4/opencv2/flann/sampling.h
+include/opencv4/opencv2/flann/saving.h
+include/opencv4/opencv2/flann/simplex_downhill.h
+include/opencv4/opencv2/flann/timer.h
+include/opencv4/opencv2/gapi.hpp
+include/opencv4/opencv2/gapi/core.hpp
+include/opencv4/opencv2/gapi/cpu/core.hpp
+include/opencv4/opencv2/gapi/cpu/gcpukernel.hpp
+include/opencv4/opencv2/gapi/cpu/imgproc.hpp
+include/opencv4/opencv2/gapi/cpu/stereo.hpp
+include/opencv4/opencv2/gapi/cpu/video.hpp
+include/opencv4/opencv2/gapi/fluid/core.hpp
+include/opencv4/opencv2/gapi/fluid/gfluidbuffer.hpp
+include/opencv4/opencv2/gapi/fluid/gfluidkernel.hpp
+include/opencv4/opencv2/gapi/fluid/imgproc.hpp
+include/opencv4/opencv2/gapi/garg.hpp
+include/opencv4/opencv2/gapi/garray.hpp
+include/opencv4/opencv2/gapi/gasync_context.hpp
+include/opencv4/opencv2/gapi/gcall.hpp
+include/opencv4/opencv2/gapi/gcommon.hpp
+include/opencv4/opencv2/gapi/gcompiled.hpp
+include/opencv4/opencv2/gapi/gcompiled_async.hpp
+include/opencv4/opencv2/gapi/gcompoundkernel.hpp
+include/opencv4/opencv2/gapi/gcomputation.hpp
+include/opencv4/opencv2/gapi/gcomputation_async.hpp
+include/opencv4/opencv2/gapi/gframe.hpp
+include/opencv4/opencv2/gapi/gkernel.hpp
+include/opencv4/opencv2/gapi/gmat.hpp
+include/opencv4/opencv2/gapi/gmetaarg.hpp
+include/opencv4/opencv2/gapi/gopaque.hpp
+include/opencv4/opencv2/gapi/gproto.hpp
+include/opencv4/opencv2/gapi/gpu/core.hpp
+include/opencv4/opencv2/gapi/gpu/ggpukernel.hpp
+include/opencv4/opencv2/gapi/gpu/imgproc.hpp
+include/opencv4/opencv2/gapi/gscalar.hpp
+include/opencv4/opencv2/gapi/gstreaming.hpp
+include/opencv4/opencv2/gapi/gtransform.hpp
+include/opencv4/opencv2/gapi/gtype_traits.hpp
+include/opencv4/opencv2/gapi/gtyped.hpp
+include/opencv4/opencv2/gapi/imgproc.hpp
+include/opencv4/opencv2/gapi/infer.hpp
+include/opencv4/opencv2/gapi/infer/bindings_ie.hpp
+include/opencv4/opencv2/gapi/infer/bindings_onnx.hpp
+include/opencv4/opencv2/gapi/infer/ie.hpp
+include/opencv4/opencv2/gapi/infer/onnx.hpp
+include/opencv4/opencv2/gapi/infer/parsers.hpp
+include/opencv4/opencv2/gapi/media.hpp
+include/opencv4/opencv2/gapi/oak/infer.hpp
+include/opencv4/opencv2/gapi/oak/oak.hpp
+include/opencv4/opencv2/gapi/ocl/core.hpp
+include/opencv4/opencv2/gapi/ocl/goclkernel.hpp
+include/opencv4/opencv2/gapi/ocl/imgproc.hpp
+include/opencv4/opencv2/gapi/opencv_includes.hpp
+include/opencv4/opencv2/gapi/operators.hpp
+include/opencv4/opencv2/gapi/own/assert.hpp
+include/opencv4/opencv2/gapi/own/convert.hpp
+include/opencv4/opencv2/gapi/own/cvdefs.hpp
+include/opencv4/opencv2/gapi/own/exports.hpp
+include/opencv4/opencv2/gapi/own/mat.hpp
+include/opencv4/opencv2/gapi/own/saturate.hpp
+include/opencv4/opencv2/gapi/own/scalar.hpp
+include/opencv4/opencv2/gapi/own/types.hpp
+include/opencv4/opencv2/gapi/plaidml/core.hpp
+include/opencv4/opencv2/gapi/plaidml/gplaidmlkernel.hpp
+include/opencv4/opencv2/gapi/plaidml/plaidml.hpp
+include/opencv4/opencv2/gapi/python/python.hpp
+include/opencv4/opencv2/gapi/render.hpp
+include/opencv4/opencv2/gapi/render/render.hpp
+include/opencv4/opencv2/gapi/render/render_types.hpp
+include/opencv4/opencv2/gapi/rmat.hpp
+include/opencv4/opencv2/gapi/s11n.hpp
+include/opencv4/opencv2/gapi/s11n/base.hpp
+include/opencv4/opencv2/gapi/stereo.hpp
+include/opencv4/opencv2/gapi/streaming/cap.hpp
+include/opencv4/opencv2/gapi/streaming/desync.hpp
+include/opencv4/opencv2/gapi/streaming/format.hpp
+include/opencv4/opencv2/gapi/streaming/gstreamer/gstreamerpipeline.hpp
+include/opencv4/opencv2/gapi/streaming/gstreamer/gstreamersource.hpp
+include/opencv4/opencv2/gapi/streaming/meta.hpp
+include/opencv4/opencv2/gapi/streaming/onevpl/accel_types.hpp
+include/opencv4/opencv2/gapi/streaming/onevpl/cfg_params.hpp
+include/opencv4/opencv2/gapi/streaming/onevpl/data_provider_interface.hpp
+include/opencv4/opencv2/gapi/streaming/onevpl/default.hpp
+include/opencv4/opencv2/gapi/streaming/onevpl/device_selector_interface.hpp
+include/opencv4/opencv2/gapi/streaming/onevpl/source.hpp
+include/opencv4/opencv2/gapi/streaming/source.hpp
+include/opencv4/opencv2/gapi/streaming/sync.hpp
+include/opencv4/opencv2/gapi/util/any.hpp
+include/opencv4/opencv2/gapi/util/compiler_hints.hpp
+include/opencv4/opencv2/gapi/util/copy_through_move.hpp
+include/opencv4/opencv2/gapi/util/optional.hpp
+include/opencv4/opencv2/gapi/util/throw.hpp
+include/opencv4/opencv2/gapi/util/type_traits.hpp
+include/opencv4/opencv2/gapi/util/util.hpp
+include/opencv4/opencv2/gapi/util/variant.hpp
+include/opencv4/opencv2/gapi/video.hpp
+include/opencv4/opencv2/highgui.hpp
+include/opencv4/opencv2/highgui/highgui.hpp
+include/opencv4/opencv2/highgui/highgui_c.h
+include/opencv4/opencv2/imgcodecs.hpp
+include/opencv4/opencv2/imgcodecs/imgcodecs.hpp
+include/opencv4/opencv2/imgcodecs/imgcodecs_c.h
+include/opencv4/opencv2/imgcodecs/ios.h
+include/opencv4/opencv2/imgcodecs/legacy/constants_c.h
+include/opencv4/opencv2/imgcodecs/macosx.h
+include/opencv4/opencv2/imgproc.hpp
+include/opencv4/opencv2/imgproc/bindings.hpp
+include/opencv4/opencv2/imgproc/detail/gcgraph.hpp
+include/opencv4/opencv2/imgproc/hal/hal.hpp
+include/opencv4/opencv2/imgproc/hal/interface.h
+include/opencv4/opencv2/imgproc/imgproc.hpp
+include/opencv4/opencv2/imgproc/imgproc_c.h
+include/opencv4/opencv2/imgproc/segmentation.hpp
+include/opencv4/opencv2/imgproc/types_c.h
+include/opencv4/opencv2/ml.hpp
+include/opencv4/opencv2/ml/ml.hpp
+include/opencv4/opencv2/ml/ml.inl.hpp
+include/opencv4/opencv2/objdetect.hpp
+include/opencv4/opencv2/objdetect/aruco_board.hpp
+include/opencv4/opencv2/objdetect/aruco_detector.hpp
+include/opencv4/opencv2/objdetect/aruco_dictionary.hpp
+include/opencv4/opencv2/objdetect/charuco_detector.hpp
+include/opencv4/opencv2/objdetect/detection_based_tracker.hpp
+include/opencv4/opencv2/objdetect/face.hpp
+include/opencv4/opencv2/objdetect/objdetect.hpp
+include/opencv4/opencv2/opencv.hpp
+include/opencv4/opencv2/opencv_modules.hpp
+include/opencv4/opencv2/photo.hpp
+include/opencv4/opencv2/photo/cuda.hpp
+include/opencv4/opencv2/photo/legacy/constants_c.h
+include/opencv4/opencv2/photo/photo.hpp
+include/opencv4/opencv2/stitching.hpp
+include/opencv4/opencv2/stitching/detail/autocalib.hpp
+include/opencv4/opencv2/stitching/detail/blenders.hpp
+include/opencv4/opencv2/stitching/detail/camera.hpp
+include/opencv4/opencv2/stitching/detail/exposure_compensate.hpp
+include/opencv4/opencv2/stitching/detail/matchers.hpp
+include/opencv4/opencv2/stitching/detail/motion_estimators.hpp
+include/opencv4/opencv2/stitching/detail/seam_finders.hpp
+include/opencv4/opencv2/stitching/detail/timelapsers.hpp
+include/opencv4/opencv2/stitching/detail/util.hpp
+include/opencv4/opencv2/stitching/detail/util_inl.hpp
+include/opencv4/opencv2/stitching/detail/warpers.hpp
+include/opencv4/opencv2/stitching/detail/warpers_inl.hpp
+include/opencv4/opencv2/stitching/warpers.hpp
+include/opencv4/opencv2/video.hpp
+include/opencv4/opencv2/video/background_segm.hpp
+include/opencv4/opencv2/video/detail/tracking.detail.hpp
+include/opencv4/opencv2/video/legacy/constants_c.h
+include/opencv4/opencv2/video/tracking.hpp
+include/opencv4/opencv2/video/video.hpp
+include/opencv4/opencv2/videoio.hpp
+include/opencv4/opencv2/videoio/cap_ios.h
+include/opencv4/opencv2/videoio/legacy/constants_c.h
+include/opencv4/opencv2/videoio/registry.hpp
+include/opencv4/opencv2/videoio/videoio.hpp
+include/opencv4/opencv2/videoio/videoio_c.h
+lib/cmake/opencv4/OpenCVConfig-version.cmake
+lib/cmake/opencv4/OpenCVConfig.cmake
+lib/cmake/opencv4/OpenCVModules-release.cmake
+lib/cmake/opencv4/OpenCVModules.cmake
+lib/libopencv_calib3d.so
+lib/libopencv_calib3d.so.${PKGVERSION}
+lib/libopencv_calib3d.so.407
+lib/libopencv_core.so
+lib/libopencv_core.so.${PKGVERSION}
+lib/libopencv_core.so.407
+lib/libopencv_dnn.so
+lib/libopencv_dnn.so.${PKGVERSION}
+lib/libopencv_dnn.so.407
+lib/libopencv_features2d.so
+lib/libopencv_features2d.so.${PKGVERSION}
+lib/libopencv_features2d.so.407
+lib/libopencv_flann.so
+lib/libopencv_flann.so.${PKGVERSION}
+lib/libopencv_flann.so.407
+lib/libopencv_gapi.so
+lib/libopencv_gapi.so.${PKGVERSION}
+lib/libopencv_gapi.so.407
+lib/libopencv_highgui.so
+lib/libopencv_highgui.so.${PKGVERSION}
+lib/libopencv_highgui.so.407
+lib/libopencv_imgcodecs.so
+lib/libopencv_imgcodecs.so.${PKGVERSION}
+lib/libopencv_imgcodecs.so.407
+lib/libopencv_imgproc.so
+lib/libopencv_imgproc.so.${PKGVERSION}
+lib/libopencv_imgproc.so.407
+lib/libopencv_ml.so
+lib/libopencv_ml.so.${PKGVERSION}
+lib/libopencv_ml.so.407
+lib/libopencv_objdetect.so
+lib/libopencv_objdetect.so.${PKGVERSION}
+lib/libopencv_objdetect.so.407
+lib/libopencv_photo.so
+lib/libopencv_photo.so.${PKGVERSION}
+lib/libopencv_photo.so.407
+lib/libopencv_stitching.so
+lib/libopencv_stitching.so.${PKGVERSION}
+lib/libopencv_stitching.so.407
+lib/libopencv_video.so
+lib/libopencv_video.so.${PKGVERSION}
+lib/libopencv_video.so.407
+lib/libopencv_videoio.so
+lib/libopencv_videoio.so.${PKGVERSION}
+lib/libopencv_videoio.so.407
+${PYSITELIB}/cv2/__init__.py
+${PYSITELIB}/cv2/config-${PYVERSSUFFIX}.py
+${PYSITELIB}/cv2/config.py
+${PYSITELIB}/cv2/gapi/__init__.py
+${PYSITELIB}/cv2/load_config_py2.py
+${PYSITELIB}/cv2/load_config_py3.py
+${PYSITELIB}/cv2/mat_wrapper/__init__.py
+${PYSITELIB}/cv2/misc/__init__.py
+${PYSITELIB}/cv2/misc/version.py
+${PYSITELIB}/cv2/python-${PYVERSSUFFIX}/cv2.so
+${PYSITELIB}/cv2/utils/__init__.py
+share/opencv4/haarcascades/haarcascade_eye.xml
+share/opencv4/haarcascades/haarcascade_eye_tree_eyeglasses.xml
+share/opencv4/haarcascades/haarcascade_frontalcatface.xml
+share/opencv4/haarcascades/haarcascade_frontalcatface_extended.xml
+share/opencv4/haarcascades/haarcascade_frontalface_alt.xml
+share/opencv4/haarcascades/haarcascade_frontalface_alt2.xml
+share/opencv4/haarcascades/haarcascade_frontalface_alt_tree.xml
+share/opencv4/haarcascades/haarcascade_frontalface_default.xml
+share/opencv4/haarcascades/haarcascade_fullbody.xml
+share/opencv4/haarcascades/haarcascade_lefteye_2splits.xml
+share/opencv4/haarcascades/haarcascade_license_plate_rus_16stages.xml
+share/opencv4/haarcascades/haarcascade_lowerbody.xml
+share/opencv4/haarcascades/haarcascade_profileface.xml
+share/opencv4/haarcascades/haarcascade_righteye_2splits.xml
+share/opencv4/haarcascades/haarcascade_russian_plate_number.xml
+share/opencv4/haarcascades/haarcascade_smile.xml
+share/opencv4/haarcascades/haarcascade_upperbody.xml
+share/opencv4/lbpcascades/lbpcascade_frontalcatface.xml
+share/opencv4/lbpcascades/lbpcascade_frontalface.xml
+share/opencv4/lbpcascades/lbpcascade_frontalface_improved.xml
+share/opencv4/lbpcascades/lbpcascade_profileface.xml
+share/opencv4/lbpcascades/lbpcascade_silverware.xml
+share/opencv4/licenses/SoftFloat-COPYING.txt
+share/opencv4/licenses/ade-LICENSE
+share/opencv4/licenses/ittnotify-LICENSE.BSD
+share/opencv4/licenses/ittnotify-LICENSE.GPL
+share/opencv4/licenses/libopenjp2-LICENSE
+share/opencv4/licenses/libopenjp2-README.md
+share/opencv4/licenses/opencl-headers-LICENSE.txt
+share/opencv4/licenses/quirc-LICENSE
+share/opencv4/valgrind.supp
+share/opencv4/valgrind_3rdparty.supp
diff --git a/opencv/buildlink3.mk b/opencv/buildlink3.mk
new file mode 100644
index 0000000000..4024e20812
--- /dev/null
+++ b/opencv/buildlink3.mk
@@ -0,0 +1,29 @@
+# $NetBSD: buildlink3.mk,v 1.16 2023/01/03 17:36:26 wiz Exp $
+
+BUILDLINK_TREE+=	opencv
+
+.if !defined(OPENCV_BUILDLINK3_MK)
+OPENCV_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.opencv+=	opencv>=3.0.0
+BUILDLINK_ABI_DEPENDS.opencv+=	opencv>=4
+BUILDLINK_PKGSRCDIR.opencv?=	../../wip/opencv
+
+BUILDLINK_INCDIRS.opencv+=	include/opencv4
+
+pkgbase := opencv
+.include "../../mk/pkg-build-options.mk"
+
+.include "../../devel/protobuf/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+.if ${PKG_BUILD_OPTIONS.opencv:Mjasper}
+.  include "../../graphics/jasper/buildlink3.mk"
+.endif
+.include "../../graphics/libwebp/buildlink3.mk"
+.include "../../graphics/openexr/buildlink3.mk"
+.include "../../graphics/png/buildlink3.mk"
+.include "../../graphics/tiff/buildlink3.mk"
+.include "../../mk/jpeg.buildlink3.mk"
+.endif	# OPENCV_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-opencv
diff --git a/opencv/distinfo b/opencv/distinfo
new file mode 100644
index 0000000000..0eb765c7b3
--- /dev/null
+++ b/opencv/distinfo
@@ -0,0 +1,28 @@
+$NetBSD: distinfo,v 1.57 2021/10/26 10:46:34 nia Exp $
+
+BLAKE2s (opencv-4.7.0.tar.gz) = a534cd707402cb06c9e75a6ed7df67744ec2b5ccbd498c44a692da5fd728ca9e
+SHA512 (opencv-4.7.0.tar.gz) = f799e1eb4ef1eb81212319cf908d0a64d2d5179c8da86b919b06e96a6870a9f3ed33251223a841b71711349018ea6782c174179fa59958a1573e22d11cc9347d
+Size (opencv-4.7.0.tar.gz) = 91027497 bytes
+SHA1 (patch-3rdparty_ippicv_ippicv.cmake) = 14ce5de382084793ace32f43c6dfaf01f7ffb390
+SHA1 (patch-3rdparty_protobuf_src_google_protobuf_message__lite.cc) = 821799845336a2cf767f77a8e38512ddc4b0a0af
+SHA1 (patch-CMakeLists.txt) = 534ad3b8834d76f1318e97ccecdc17c9d932c455
+SHA1 (patch-apps_visualisation_opencv__visualisation.cpp) = b62c32172049c6369fd62a5c72325eef995fd1d0
+SHA1 (patch-cmake_OpenCVDetectCXXCompiler.cmake) = ac7deccedcc5071d3785c7827a06419713ba0529
+SHA1 (patch-cmake_OpenCVDetectPython.cmake) = 4f3bfe574edf083ebc7e78d347355c58461b2c6b
+SHA1 (patch-cmake_OpenCVFindOpenEXR.cmake) = 2e3835545ef7b3c174dffc618fea32d6eac792c4
+SHA1 (patch-cmake_checks_lapack__check.cpp) = dd25d34fff25e0d46651789cf5577391d7b48c81
+SHA1 (patch-modules_core_include_opencv2_core_bindings__utils.hpp) = 44a8602670141b2a3bc90c5e1c23a8e7f96a1d40
+SHA1 (patch-modules_core_include_opencv2_core_opencl_opencl__info.hpp) = f0cff24b2a760086f54ab66536bdfee4f4f1a6d7
+SHA1 (patch-modules_core_include_opencv2_core_types_c.h) = 75444e65677be99af8167f9060419d7970a7adaa
+SHA1 (patch-modules_core_src_check.cpp) = c8dac4e0fb6fa4a0dca6a2794bd598ba114e78b6
+SHA1 (patch-modules_core_src_downhill__simplex.cpp) = 1ad7c2fa126d15050b87785e8eec20dbe796b471
+SHA1 (patch-modules_core_src_rand.cpp) = 0ff4f01eaee2ee67536d8721b37506daf2231f10
+SHA1 (patch-modules_core_src_system.cpp) = 972533f71b024ac852af321d2e030f67dc960eed
+SHA1 (patch-modules_dnn_src_layers_accum__layer.cpp) = 20a12489f7e7fcbc90d47871f12ac500ab8ae6ed
+SHA1 (patch-modules_dnn_src_tensorflow_tf__importer.cpp) = 9b3628d91c2217c4b1ed77413efd4c0bf85758c4
+SHA1 (patch-modules_dnn_src_torch_torch__importer.cpp) = 814a3cc929569b691d01e34252dbd185f31161c2
+SHA1 (patch-modules_dnn_test_test__precomp.hpp) = 9bf15d32394f36b92e5fc5d57fd576b3860233ae
+SHA1 (patch-modules_flann_include_opencv2_flann_defines.h) = ab848e67c4e03219670598ac2d21071a617a5c33
+SHA1 (patch-modules_imgproc_src_resize.cpp) = e842d5960c4c00162a34f46cb45cf69d0e9f21ce
+SHA1 (patch-modules_ts_src_ts.cpp) = b9a3992014b02dbd89d46375a2476385e91dc24c
+SHA1 (patch-modules_videoio_src_cap__v4l.cpp) = e2b57da448f48298c108a1158bc8accc88070c94
diff --git a/opencv/hacks.mk b/opencv/hacks.mk
new file mode 100644
index 0000000000..53e143d017
--- /dev/null
+++ b/opencv/hacks.mk
@@ -0,0 +1,19 @@
+# $NetBSD: hacks.mk,v 1.3 2021/10/06 21:10:24 adam Exp $
+
+.if !defined(OPENCV_HACKS_MK)
+OPENCV_HACKS_MK=	defined
+
+.include "../../mk/bsd.fast.prefs.mk"
+.include "../../mk/compiler.mk"
+
+# PR toolchain/47051: gcc-4.5.4 breaks opencv on amd64
+.if !empty(PKGSRC_COMPILER:Mgcc) && !empty(CC_VERSION:Mgcc-4.5.4*) && !empty(MACHINE_PLATFORM:M*-*-x86_64)
+PKG_HACKS+=		tree-pre
+SUBST_CLASSES+=		opt-hack
+SUBST_STAGE.opt-hack=	post-configure
+SUBST_MESSAGE.opt-hack=	Working around gcc-4.5.4 bug.
+SUBST_FILES.opt-hack=	modules/calib3d/CMakeFiles/opencv_calib3d.dir/build.make
+SUBST_SED.opt-hack=	-e '/stereosgbm.cpp.o/s/-o /-fno-tree-pre -o /'
+.endif
+
+.endif	# OPENCV_HACKS_MK
diff --git a/opencv/options.mk b/opencv/options.mk
new file mode 100644
index 0000000000..19416a5083
--- /dev/null
+++ b/opencv/options.mk
@@ -0,0 +1,41 @@
+# $NetBSD: options.mk,v 1.13 2020/08/03 23:02:18 joerg Exp $
+
+PKG_OPTIONS_VAR=	PKG_OPTIONS.opencv
+PKG_SUPPORTED_OPTIONS=	ffmpeg jasper
+
+.include "../../mk/bsd.prefs.mk"
+
+.if ${OPSYS} != "Darwin"
+PKG_SUPPORTED_OPTIONS+=	gtk
+PKG_SUGGESTED_OPTIONS+=	gtk
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mffmpeg)
+CMAKE_ARGS+=	-DWITH_FFMPEG=ON
+CMAKE_ARGS+=	-DFFMPEG_INCLUDE_DIR=${PREFIX}/include/ffmpeg4
+CMAKE_ARGS+=	-DFFMPEG_LIB_DIR=${PREFIX}/lib/ffmpeg4
+.include "../../multimedia/ffmpeg4/buildlink3.mk"
+.else
+CMAKE_ARGS+=	-DWITH_FFMPEG=OFF
+.endif
+
+.if !empty(PKG_OPTIONS:Mjasper)
+CMAKE_ARGS+=	-DWITH_JASPER=ON
+# jasper uses SIZE_MAX and friends in its headers.
+CXXFLAGS+=	-D__STDC_LIMIT_MACROS
+.include "../../graphics/jasper/buildlink3.mk"
+.else
+CMAKE_ARGS+=	-DWITH_JASPER=OFF
+.endif
+
+.if !empty(PKG_OPTIONS:Mgtk)
+CMAKE_ARGS+=	-DWITH_GTK=ON
+.include "../../x11/gtk3/buildlink3.mk"
+.else
+CMAKE_ARGS+=	-DWITH_GTK=OFF
+.endif
+
+# FIXME: should be option.mk'ed instead
+CMAKE_ARGS+=	-DBUILD_DOCS=OFF
diff --git a/opencv/patches/patch-3rdparty_ippicv_ippicv.cmake b/opencv/patches/patch-3rdparty_ippicv_ippicv.cmake
new file mode 100644
index 0000000000..84a271c481
--- /dev/null
+++ b/opencv/patches/patch-3rdparty_ippicv_ippicv.cmake
@@ -0,0 +1,12 @@
+$NetBSD: patch-3rdparty_ippicv_ippicv.cmake,v 1.1 2017/09/04 15:23:49 fhajny Exp $
+
+Do not download at build time.
+
+--- 3rdparty/ippicv/ippicv.cmake.orig	2017-08-03 23:58:23.000000000 +0000
++++ 3rdparty/ippicv/ippicv.cmake
+@@ -1,4 +1,5 @@
+ function(download_ippicv root_var)
++  return()
+   set(${root_var} "" PARENT_SCOPE)
+ 
+   # Commit SHA in the opencv_3rdparty repo
diff --git a/opencv/patches/patch-3rdparty_protobuf_src_google_protobuf_message__lite.cc b/opencv/patches/patch-3rdparty_protobuf_src_google_protobuf_message__lite.cc
new file mode 100644
index 0000000000..506a874bd6
--- /dev/null
+++ b/opencv/patches/patch-3rdparty_protobuf_src_google_protobuf_message__lite.cc
@@ -0,0 +1,14 @@
+$NetBSD: patch-3rdparty_protobuf_src_google_protobuf_message__lite.cc,v 1.1 2017/09/04 15:23:49 fhajny Exp $
+
+Needed for INT_MAX.
+
+--- 3rdparty/protobuf/src/google/protobuf/message_lite.cc.orig	2022-12-28 14:31:52.000000000 +0000
++++ 3rdparty/protobuf/src/google/protobuf/message_lite.cc
+@@ -38,6 +38,7 @@
+ #include <climits>
+ #include <cstdint>
+ #include <string>
++#include <climits>
+ 
+ #include <google/protobuf/stubs/logging.h>
+ #include <google/protobuf/stubs/common.h>
diff --git a/opencv/patches/patch-CMakeLists.txt b/opencv/patches/patch-CMakeLists.txt
new file mode 100644
index 0000000000..36166d76de
--- /dev/null
+++ b/opencv/patches/patch-CMakeLists.txt
@@ -0,0 +1,65 @@
+$NetBSD: patch-CMakeLists.txt,v 1.9 2019/12/29 10:00:08 markd Exp $
+
+Don't add to CMAKE_LIBRARY_PATH, may cause other versions of packages
+to be found in preference to pkgsrc ones.
+Do not build third party libraries on Darwin.
+
+--- CMakeLists.txt.orig	2022-12-28 14:31:52.000000000 +0000
++++ CMakeLists.txt
+@@ -167,34 +167,6 @@ endif()
+ include(cmake/OpenCVDetectCXXCompiler.cmake)
+ ocv_cmake_hook(POST_DETECT_COMPILER)
+ 
+-# Add these standard paths to the search paths for FIND_LIBRARY
+-# to find libraries from these locations first
+-if(UNIX AND NOT ANDROID)
+-  if(X86_64 OR CMAKE_SIZEOF_VOID_P EQUAL 8)
+-    if(EXISTS /lib64)
+-      list(APPEND CMAKE_LIBRARY_PATH /lib64)
+-    else()
+-      list(APPEND CMAKE_LIBRARY_PATH /lib)
+-    endif()
+-    if(EXISTS /usr/lib64)
+-      list(APPEND CMAKE_LIBRARY_PATH /usr/lib64)
+-    else()
+-      list(APPEND CMAKE_LIBRARY_PATH /usr/lib)
+-    endif()
+-  elseif(X86 OR CMAKE_SIZEOF_VOID_P EQUAL 4)
+-    if(EXISTS /lib32)
+-      list(APPEND CMAKE_LIBRARY_PATH /lib32)
+-    else()
+-      list(APPEND CMAKE_LIBRARY_PATH /lib)
+-    endif()
+-    if(EXISTS /usr/lib32)
+-      list(APPEND CMAKE_LIBRARY_PATH /usr/lib32)
+-    else()
+-      list(APPEND CMAKE_LIBRARY_PATH /usr/lib)
+-    endif()
+-  endif()
+-endif()
+-
+ # Add these standard paths to the search paths for FIND_PATH
+ # to find include files from these locations first
+ if(MINGW)
+@@ -217,14 +189,14 @@ OCV_OPTION(OPENCV_ENABLE_NONFREE "Enable
+ 
+ # 3rd party libs
+ OCV_OPTION(OPENCV_FORCE_3RDPARTY_BUILD   "Force using 3rdparty code from source" OFF)
+-OCV_OPTION(BUILD_ZLIB               "Build zlib from source"             (WIN32 OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
+-OCV_OPTION(BUILD_TIFF               "Build libtiff from source"          (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
+-OCV_OPTION(BUILD_OPENJPEG           "Build OpenJPEG from source"         (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
+-OCV_OPTION(BUILD_JASPER             "Build libjasper from source"        (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
+-OCV_OPTION(BUILD_JPEG               "Build libjpeg from source"          (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
+-OCV_OPTION(BUILD_PNG                "Build libpng from source"           (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
++OCV_OPTION(BUILD_ZLIB               "Build zlib from source"             (WIN32 OR OPENCV_FORCE_3RDPARTY_BUILD) )
++OCV_OPTION(BUILD_TIFF               "Build libtiff from source"          (WIN32 OR ANDROID OR OPENCV_FORCE_3RDPARTY_BUILD) )
++OCV_OPTION(BUILD_OPENJPEG           "Build OpenJPEG from source"         (WIN32 OR ANDROID OR OPENCV_FORCE_3RDPARTY_BUILD) )
++OCV_OPTION(BUILD_JASPER             "Build libjasper from source"        (WIN32 OR ANDROID OR OPENCV_FORCE_3RDPARTY_BUILD) )
++OCV_OPTION(BUILD_JPEG               "Build libjpeg from source"          (WIN32 OR ANDROID OR OPENCV_FORCE_3RDPARTY_BUILD) )
++OCV_OPTION(BUILD_PNG                "Build libpng from source"           (WIN32 OR ANDROID OR OPENCV_FORCE_3RDPARTY_BUILD) )
+ OCV_OPTION(BUILD_OPENEXR            "Build openexr from source"          (OPENCV_FORCE_3RDPARTY_BUILD) )
+-OCV_OPTION(BUILD_WEBP               "Build WebP from source"             (((WIN32 OR ANDROID OR APPLE) AND NOT WINRT) OR OPENCV_FORCE_3RDPARTY_BUILD) )
++OCV_OPTION(BUILD_WEBP               "Build WebP from source"             (((WIN32 OR ANDROID) AND NOT WINRT) OR OPENCV_FORCE_3RDPARTY_BUILD) )
+ OCV_OPTION(BUILD_TBB                "Download and build TBB from source" (ANDROID OR OPENCV_FORCE_3RDPARTY_BUILD) )
+ OCV_OPTION(BUILD_IPP_IW             "Build IPP IW from source"           (NOT MINGW OR OPENCV_FORCE_3RDPARTY_BUILD) IF (X86_64 OR X86) AND NOT WINRT )
+ OCV_OPTION(BUILD_ITT                "Build Intel ITT from source"
diff --git a/opencv/patches/patch-apps_visualisation_opencv__visualisation.cpp b/opencv/patches/patch-apps_visualisation_opencv__visualisation.cpp
new file mode 100644
index 0000000000..9daceddac4
--- /dev/null
+++ b/opencv/patches/patch-apps_visualisation_opencv__visualisation.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-apps_visualisation_opencv__visualisation.cpp,v 1.1 2020/04/18 22:01:33 joerg Exp $
+
+--- apps/visualisation/opencv_visualisation.cpp.orig	2020-04-18 02:44:25.906562998 +0000
++++ apps/visualisation/opencv_visualisation.cpp
+@@ -60,6 +60,7 @@ Created by: Puttemans Steven - April 201
+ 
+ #include <fstream>
+ #include <iostream>
++#include <sstream>
+ 
+ using namespace std;
+ using namespace cv;
diff --git a/opencv/patches/patch-cmake_OpenCVDetectCXXCompiler.cmake b/opencv/patches/patch-cmake_OpenCVDetectCXXCompiler.cmake
new file mode 100644
index 0000000000..85d967a7a6
--- /dev/null
+++ b/opencv/patches/patch-cmake_OpenCVDetectCXXCompiler.cmake
@@ -0,0 +1,17 @@
+$NetBSD: patch-cmake_OpenCVDetectCXXCompiler.cmake,v 1.2 2020/02/13 09:23:46 adam Exp $
+
+Rely on pkgsrc to set architeture, see CONFIGURE_ENV.
+
+--- cmake/OpenCVDetectCXXCompiler.cmake.orig	2019-12-19 15:16:47.000000000 +0000
++++ cmake/OpenCVDetectCXXCompiler.cmake
+@@ -84,6 +84,10 @@ endif()
+ message(STATUS "Detected processor: ${CMAKE_SYSTEM_PROCESSOR}")
+ if(OPENCV_SKIP_SYSTEM_PROCESSOR_DETECTION)
+   # custom setup: required variables are passed through cache / CMake's command-line
++elseif("$ENV{MACHINE_ARCH}" MATCHES "x86_64")
++  set(X86_64 1)
++elseif("$ENV{MACHINE_ARCH}" MATCHES "i386")
++  set(X86 1)
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
+   set(X86_64 1)
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*")
diff --git a/opencv/patches/patch-cmake_OpenCVDetectPython.cmake b/opencv/patches/patch-cmake_OpenCVDetectPython.cmake
new file mode 100644
index 0000000000..c867789fed
--- /dev/null
+++ b/opencv/patches/patch-cmake_OpenCVDetectPython.cmake
@@ -0,0 +1,20 @@
+$NetBSD: patch-cmake_OpenCVDetectPython.cmake,v 1.1 2019/12/16 08:24:39 adam Exp $
+
+Do not look for Python 2.x.
+
+--- cmake/OpenCVDetectPython.cmake.orig	2019-12-16 06:04:25.000000000 +0000
++++ cmake/OpenCVDetectPython.cmake
+@@ -268,13 +268,6 @@ if(OPENCV_PYTHON_SKIP_DETECTION)
+   return()
+ endif()
+ 
+-find_python("" "${MIN_VER_PYTHON2}" PYTHON2_LIBRARY PYTHON2_INCLUDE_DIR
+-    PYTHON2INTERP_FOUND PYTHON2_EXECUTABLE PYTHON2_VERSION_STRING
+-    PYTHON2_VERSION_MAJOR PYTHON2_VERSION_MINOR PYTHON2LIBS_FOUND
+-    PYTHON2LIBS_VERSION_STRING PYTHON2_LIBRARIES PYTHON2_LIBRARY
+-    PYTHON2_DEBUG_LIBRARIES PYTHON2_LIBRARY_DEBUG PYTHON2_INCLUDE_PATH
+-    PYTHON2_INCLUDE_DIR PYTHON2_INCLUDE_DIR2 PYTHON2_PACKAGES_PATH
+-    PYTHON2_NUMPY_INCLUDE_DIRS PYTHON2_NUMPY_VERSION)
+ 
+ option(OPENCV_PYTHON3_VERSION "Python3 version" "")
+ find_python("${OPENCV_PYTHON3_VERSION}" "${MIN_VER_PYTHON3}" PYTHON3_LIBRARY PYTHON3_INCLUDE_DIR
diff --git a/opencv/patches/patch-cmake_OpenCVFindOpenEXR.cmake b/opencv/patches/patch-cmake_OpenCVFindOpenEXR.cmake
new file mode 100644
index 0000000000..76515c0fab
--- /dev/null
+++ b/opencv/patches/patch-cmake_OpenCVFindOpenEXR.cmake
@@ -0,0 +1,21 @@
+$NetBSD: patch-cmake_OpenCVFindOpenEXR.cmake,v 1.1 2021/07/08 21:27:39 markd Exp $
+
+openexr3
+
+--- cmake/OpenCVFindOpenEXR.cmake.orig	2022-12-28 14:31:52.000000000 +0000
++++ cmake/OpenCVFindOpenEXR.cmake
+@@ -25,6 +25,14 @@ if(NOT OPENCV_SKIP_OPENEXR_FIND_PACKAGE)
+   endif()
+ endif()
+ 
++find_package(OpenEXR 3.0 CONFIG QUIET)
++if(TARGET OpenEXR::OpenEXR)
++    SET(OPENEXR_FOUND TRUE)
++    SET(OPENEXR_LIBRARIES OpenEXR::OpenEXR)
++    SET(OPENEXR_VERSION ${OpenEXR_VERSION})
++    return()
++endif()
++
+ SET(OPENEXR_LIBRARIES "")
+ SET(OPENEXR_LIBSEARCH_SUFFIXES "")
+ file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH)
diff --git a/opencv/patches/patch-cmake_checks_lapack__check.cpp b/opencv/patches/patch-cmake_checks_lapack__check.cpp
new file mode 100644
index 0000000000..2a0568b2e5
--- /dev/null
+++ b/opencv/patches/patch-cmake_checks_lapack__check.cpp
@@ -0,0 +1,20 @@
+$NetBSD: patch-cmake_checks_lapack__check.cpp,v 1.1 2021/09/22 13:40:41 nia Exp $
+
+https://bugs.gentoo.org/800539
+https://github.com/opencv/opencv/issues/19846
+
+--- cmake/checks/lapack_check.cpp.orig	2019-12-19 15:16:47.000000000 +0000
++++ cmake/checks/lapack_check.cpp
+@@ -2,9 +2,9 @@
+ #include "opencv_lapack.h"
+ 
+ static char* check_fn1 = (char*)sgesv_;
+-static char* check_fn2 = (char*)sposv_;
+-static char* check_fn3 = (char*)spotrf_;
+-static char* check_fn4 = (char*)sgesdd_;
++static char* check_fn2 = (char*)LAPACK_sposv_;
++static char* check_fn3 = (char*)LAPACK_spotrf_;
++static char* check_fn4 = (char*)LAPACK_sgesdd_;
+ 
+ int main(int argc, char* argv[])
+ {
diff --git a/opencv/patches/patch-modules_core_include_opencv2_core_bindings__utils.hpp b/opencv/patches/patch-modules_core_include_opencv2_core_bindings__utils.hpp
new file mode 100644
index 0000000000..8c34f6f9b1
--- /dev/null
+++ b/opencv/patches/patch-modules_core_include_opencv2_core_bindings__utils.hpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-modules_core_include_opencv2_core_bindings__utils.hpp,v 1.2 2021/10/06 21:10:24 adam Exp $
+
+--- modules/core/include/opencv2/core/bindings_utils.hpp.orig	2021-07-04 21:10:13.000000000 +0000
++++ modules/core/include/opencv2/core/bindings_utils.hpp
+@@ -5,6 +5,7 @@
+ #ifndef OPENCV_CORE_BINDINGS_UTILS_HPP
+ #define OPENCV_CORE_BINDINGS_UTILS_HPP
+ 
++#include <sstream>
+ #include <opencv2/core/async.hpp>
+ #include <opencv2/core/detail/async_promise.hpp>
+ #include <opencv2/core/utils/logger.hpp>
diff --git a/opencv/patches/patch-modules_core_include_opencv2_core_opencl_opencl__info.hpp b/opencv/patches/patch-modules_core_include_opencv2_core_opencl_opencl__info.hpp
new file mode 100644
index 0000000000..41d91872f1
--- /dev/null
+++ b/opencv/patches/patch-modules_core_include_opencv2_core_opencl_opencl__info.hpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-modules_core_include_opencv2_core_opencl_opencl__info.hpp,v 1.1 2020/04/18 22:01:33 joerg Exp $
+
+--- modules/core/include/opencv2/core/opencl/opencl_info.hpp.orig	2020-04-18 02:39:48.224336800 +0000
++++ modules/core/include/opencv2/core/opencl/opencl_info.hpp
+@@ -3,6 +3,7 @@
+ // of this distribution and at http://opencv.org/license.html.
+ 
+ #include <iostream>
++#include <sstream>
+ 
+ #include <opencv2/core.hpp>
+ #include <opencv2/core/ocl.hpp>
diff --git a/opencv/patches/patch-modules_core_include_opencv2_core_types_c.h b/opencv/patches/patch-modules_core_include_opencv2_core_types_c.h
new file mode 100644
index 0000000000..6b5a47374b
--- /dev/null
+++ b/opencv/patches/patch-modules_core_include_opencv2_core_types_c.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-modules_core_include_opencv2_core_types_c.h,v 1.2 2015/10/08 17:45:59 fhajny Exp $
+
+Define 'depth' as unsigned int, or IPL_DEPTH_SIGN=0x8000000 won't fit in int.
+
+--- modules/core/include/opencv2/core/types_c.h.orig	2015-06-03 17:21:34.000000000 +0000
++++ modules/core/include/opencv2/core/types_c.h
+@@ -303,7 +303,7 @@ _IplImage
+     int  ID;                /**< version (=0)*/
+     int  nChannels;         /**< Most of OpenCV functions support 1,2,3 or 4 channels */
+     int  alphaChannel;      /**< Ignored by OpenCV */
+-    int  depth;             /**< Pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S,
++    unsigned int  depth;             /**< Pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S,
+                                IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported.  */
+     char colorModel[4];     /**< Ignored by OpenCV */
+     char channelSeq[4];     /**< ditto */
diff --git a/opencv/patches/patch-modules_core_src_check.cpp b/opencv/patches/patch-modules_core_src_check.cpp
new file mode 100644
index 0000000000..1ce1710141
--- /dev/null
+++ b/opencv/patches/patch-modules_core_src_check.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-modules_core_src_check.cpp,v 1.1 2020/04/18 22:01:33 joerg Exp $
+
+--- modules/core/src/check.cpp.orig	2020-04-18 02:32:42.393303493 +0000
++++ modules/core/src/check.cpp
+@@ -3,6 +3,7 @@
+ // of this distribution and at http://opencv.org/license.html.
+ 
+ #include "precomp.hpp"
++#include <sstream>
+ 
+ #include "opencv2/core/check.hpp"
+ 
diff --git a/opencv/patches/patch-modules_core_src_downhill__simplex.cpp b/opencv/patches/patch-modules_core_src_downhill__simplex.cpp
new file mode 100644
index 0000000000..8363598853
--- /dev/null
+++ b/opencv/patches/patch-modules_core_src_downhill__simplex.cpp
@@ -0,0 +1,16 @@
+$NetBSD: patch-modules_core_src_downhill__simplex.cpp,v 1.1 2015/10/08 17:45:59 fhajny Exp $
+
+Avoid DS conflict on SunOS.
+
+--- modules/core/src/downhill_simplex.cpp.orig	2015-06-03 17:21:34.000000000 +0000
++++ modules/core/src/downhill_simplex.cpp
+@@ -450,6 +450,9 @@ protected:
+ };
+ 
+ 
++#if defined(__sun)
++#undef DS
++#endif
+ // both minRange & minError are specified by termcrit.epsilon;
+ // In addition, user may specify the number of iterations that the algorithm does.
+ Ptr<DownhillSolver> DownhillSolver::create( const Ptr<MinProblemSolver::Function>& f,
diff --git a/opencv/patches/patch-modules_core_src_rand.cpp b/opencv/patches/patch-modules_core_src_rand.cpp
new file mode 100644
index 0000000000..ee919e9abb
--- /dev/null
+++ b/opencv/patches/patch-modules_core_src_rand.cpp
@@ -0,0 +1,19 @@
+$NetBSD: patch-modules_core_src_rand.cpp,v 1.1 2020/09/09 11:50:50 nia Exp $
+
+Include arm_neon.h before attempting to use intrinsics.
+
+This is seemingly fixed in newer releases.
+
+--- modules/core/src/rand.cpp.orig	2022-12-28 14:31:52.000000000 +0000
++++ modules/core/src/rand.cpp
+@@ -48,6 +48,10 @@
+ 
+ #include "precomp.hpp"
+ 
++#if defined __ARM_NEON && defined __aarch64__
++    #include "arm_neon.h"
++#endif
++
+ namespace cv
+ {
+ 
diff --git a/opencv/patches/patch-modules_core_src_system.cpp b/opencv/patches/patch-modules_core_src_system.cpp
new file mode 100644
index 0000000000..83730ded74
--- /dev/null
+++ b/opencv/patches/patch-modules_core_src_system.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-modules_core_src_system.cpp,v 1.1 2013/04/29 21:31:12 joerg Exp $
+
+--- modules/core/src/system.cpp.orig	2022-12-28 14:31:52.000000000 +0000
++++ modules/core/src/system.cpp
+@@ -243,6 +243,7 @@ std::wstring GetTempFileNameWinRT(std::w
+ #endif
+ #include <sys/time.h>
+ #include <time.h>
++#include <unistd.h>
+ 
+ #if defined __MACH__ && defined __APPLE__
+ #include <mach/mach.h>
diff --git a/opencv/patches/patch-modules_dnn_src_layers_accum__layer.cpp b/opencv/patches/patch-modules_dnn_src_layers_accum__layer.cpp
new file mode 100644
index 0000000000..7a488a825b
--- /dev/null
+++ b/opencv/patches/patch-modules_dnn_src_layers_accum__layer.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-modules_dnn_src_layers_accum__layer.cpp,v 1.1 2021/10/21 16:25:07 jperkin Exp $
+
+Explicitly use std::ceil.
+
+--- modules/dnn/src/layers/accum_layer.cpp.orig	2021-10-08 18:31:56.000000000 +0000
++++ modules/dnn/src/layers/accum_layer.cpp
+@@ -8,6 +8,7 @@
+ #include "../precomp.hpp"
+ #include "layers_common.hpp"
+ 
++using std::ceil;
+ 
+ namespace cv { namespace dnn {
+ 
diff --git a/opencv/patches/patch-modules_dnn_src_tensorflow_tf__importer.cpp b/opencv/patches/patch-modules_dnn_src_tensorflow_tf__importer.cpp
new file mode 100644
index 0000000000..1c1344e564
--- /dev/null
+++ b/opencv/patches/patch-modules_dnn_src_tensorflow_tf__importer.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-modules_dnn_src_tensorflow_tf__importer.cpp,v 1.1 2020/04/18 22:01:34 joerg Exp $
+
+--- modules/dnn/src/tensorflow/tf_importer.cpp.orig	2020-04-18 02:43:16.265690888 +0000
++++ modules/dnn/src/tensorflow/tf_importer.cpp
+@@ -14,6 +14,7 @@ Implementation of Tensorflow models pars
+ #ifdef HAVE_PROTOBUF
+ #include "tf_io.hpp"
+ 
++#include <sstream>
+ #include <iostream>
+ #include <fstream>
+ #include <algorithm>
diff --git a/opencv/patches/patch-modules_dnn_src_torch_torch__importer.cpp b/opencv/patches/patch-modules_dnn_src_torch_torch__importer.cpp
new file mode 100644
index 0000000000..0c4162c01f
--- /dev/null
+++ b/opencv/patches/patch-modules_dnn_src_torch_torch__importer.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-modules_dnn_src_torch_torch__importer.cpp,v 1.1 2020/04/18 22:01:34 joerg Exp $
+
+--- modules/dnn/src/torch/torch_importer.cpp.orig	2020-04-18 02:45:10.074752904 +0000
++++ modules/dnn/src/torch/torch_importer.cpp
+@@ -46,6 +46,7 @@
+ #include <algorithm>
+ #include <iostream>
+ #include <fstream>
++#include <sstream>
+ 
+ #include "THDiskFile.h"
+ 
diff --git a/opencv/patches/patch-modules_dnn_test_test__precomp.hpp b/opencv/patches/patch-modules_dnn_test_test__precomp.hpp
new file mode 100644
index 0000000000..767be0c2ef
--- /dev/null
+++ b/opencv/patches/patch-modules_dnn_test_test__precomp.hpp
@@ -0,0 +1,20 @@
+$NetBSD: patch-modules_dnn_test__precomp.hpp,v 1.1 2019/04/29 03:23:53 mef Exp $
+
+adhoc patch to build 3.4.6
+
+[ 30%] Built target opencv_core
+/export/WRKOBJDIR/graphics/opencv/work/opencv-3.4.6/build/modules/dnn/test_precomp.hpp:50:10: fatal error: test/test_common.hpp: No such file or directory
+ #include "test/test_common.hpp"
+          ^~~~~~~~~~~~~~~~~~~~~~
+compilation terminated.
+
+--- build/modules/dnn/test_precomp.hpp.orig	2019-04-29 10:35:50.011315095 +0900
++++ modules/dnn/test/test_precomp.hpp	2019-04-29 11:11:41.277591395 +0900
+@@ -47,6 +47,6 @@
+ #include "opencv2/core/ocl.hpp"
+ 
+ #include "opencv2/dnn.hpp"
+-#include "test_common.hpp"
++#include "../test/test_common.hpp"
+ 
+ #endif
diff --git a/opencv/patches/patch-modules_flann_include_opencv2_flann_defines.h b/opencv/patches/patch-modules_flann_include_opencv2_flann_defines.h
new file mode 100644
index 0000000000..af6cf08a69
--- /dev/null
+++ b/opencv/patches/patch-modules_flann_include_opencv2_flann_defines.h
@@ -0,0 +1,16 @@
+$NetBSD: patch-modules_flann_include_opencv2_flann_defines.h,v 1.1 2013/06/12 10:13:58 jperkin Exp $
+
+Avoid CS conflict on SunOS.
+
+--- modules/flann/include/opencv2/flann/defines.h.orig	2012-09-27 22:55:06.000000000 +0000
++++ modules/flann/include/opencv2/flann/defines.h
+@@ -71,6 +71,9 @@
+ #define FLANN_PLATFORM_32_BIT
+ #endif
+ 
++#ifdef __sun
++#undef CS
++#endif
+ 
+ #undef FLANN_ARRAY_LEN
+ #define FLANN_ARRAY_LEN(a) (sizeof(a)/sizeof(a[0]))
diff --git a/opencv/patches/patch-modules_imgproc_src_resize.cpp b/opencv/patches/patch-modules_imgproc_src_resize.cpp
new file mode 100644
index 0000000000..e6923f72d3
--- /dev/null
+++ b/opencv/patches/patch-modules_imgproc_src_resize.cpp
@@ -0,0 +1,24 @@
+$NetBSD: patch-modules_imgproc_src_resize.cpp,v 1.1 2020/08/08 22:40:59 joerg Exp $
+
+On Illumos int8_t != ET, so be explicit about the cast to be used here.
+
+--- modules/imgproc/src/resize.cpp.orig	2020-08-08 22:04:15.259991576 +0000
++++ modules/imgproc/src/resize.cpp
+@@ -652,7 +652,7 @@ template <typename ET, typename FT>
+ void vlineSet(FT* src, ET* dst, int dst_width)
+ {
+     for (int i = 0; i < dst_width; i++)
+-        dst[i] = src[i];
++        dst[i] = int8_t(src[i]);
+ }
+ template <>
+ void vlineSet<uint8_t, ufixedpoint16>(ufixedpoint16* src, uint8_t* dst, int dst_width)
+@@ -684,7 +684,7 @@ void vlineResize(FT* src, size_t src_ste
+         typename FT::WT res = src[i] * m[0];
+         for (int k = 1; k < n; k++)
+             res = res + src[i + k*src_step] * m[k];
+-        dst[i] = res;
++        dst[i] = int8_t(res);
+     }
+ }
+ template <>
diff --git a/opencv/patches/patch-modules_ts_src_ts.cpp b/opencv/patches/patch-modules_ts_src_ts.cpp
new file mode 100644
index 0000000000..c9d3832d3f
--- /dev/null
+++ b/opencv/patches/patch-modules_ts_src_ts.cpp
@@ -0,0 +1,33 @@
+$NetBSD: patch-modules_ts_src_ts.cpp,v 1.3 2015/10/08 17:45:59 fhajny Exp $
+
+Avoid std::foo conflict.
+
+--- modules/ts/src/ts.cpp.orig	2015-06-03 17:21:34.000000000 +0000
++++ modules/ts/src/ts.cpp
+@@ -235,7 +235,7 @@ void BaseTest::safe_run( int start_from
+         }
+         catch (const TS::FailureCode& fc)
+         {
+-            std::string errorStr = TS::str_from_code(fc);
++            ::std::string errorStr = TS::str_from_code(fc);
+             ts->printf(TS::LOG, "General failure:\n\t%s (%d)\n", errorStr.c_str(), fc);
+ 
+             ts->set_failed_test_info( fc );
+@@ -558,7 +558,7 @@ void TS::vprintf( int streams, const cha
+     for( int i = 0; i < MAX_IDX; i++ )
+         if( (streams & (1 << i)) )
+         {
+-            output_buf[i] += std::string(str);
++            output_buf[i] += ::std::string(str);
+             // in the new GTest-based framework we do not use
+             // any output files (except for the automatically generated xml report).
+             // if a test fails, all the buffers are printed, so we do not want to duplicate the information and
+@@ -613,7 +613,7 @@ void smoothBorder(Mat& img, const Scalar
+     Scalar s;
+     uchar *p = NULL;
+     int n = 100/delta;
+-    int nR = std::min(n, (img.rows+1)/2), nC = std::min(n, (img.cols+1)/2);
++    int nR = ::std::min(n, (img.rows+1)/2), nC = ::std::min(n, (img.cols+1)/2);
+ 
+     int r, c, i;
+     for(r=0; r<nR; r++)
diff --git a/opencv/patches/patch-modules_videoio_src_cap__v4l.cpp b/opencv/patches/patch-modules_videoio_src_cap__v4l.cpp
new file mode 100644
index 0000000000..3eb5706b37
--- /dev/null
+++ b/opencv/patches/patch-modules_videoio_src_cap__v4l.cpp
@@ -0,0 +1,181 @@
+$NetBSD: patch-modules_videoio_src_cap__v4l.cpp,v 1.9 2021/10/16 07:16:29 adam Exp $
+
+Conditionalize settings not available in NetBSD's v4l2 emulation.
+Avoid non-standard integer types.
+
+--- modules/videoio/src/cap_v4l.cpp.orig	2022-12-28 14:31:52.000000000 +0000
++++ modules/videoio/src/cap_v4l.cpp
+@@ -215,6 +215,14 @@ make & enjoy!
+ #include <fcntl.h>
+ #include <errno.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 <sys/types.h>
+ #include <sys/mman.h>
+ 
+@@ -241,24 +249,30 @@ typedef uint32_t __u32;
+ #endif
+ 
+ // https://github.com/opencv/opencv/issues/13335
++#ifdef V4L2_CID_CAMERA_CLASS_BASE
+ #ifndef V4L2_CID_ISO_SENSITIVITY
+ #define V4L2_CID_ISO_SENSITIVITY (V4L2_CID_CAMERA_CLASS_BASE+23)
+ #endif
++#endif
+ 
+ // https://github.com/opencv/opencv/issues/13929
++#ifdef V4L2_CID_MPEG_BASE
+ #ifndef V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT
+ #define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE+364)
+ #endif
+ #ifndef V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH
+ #define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE+365)
+ #endif
++#endif
+ 
+ #ifndef V4L2_CID_ROTATE
+ #define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
+ #endif
++#ifdef V4L2_CID_CAMERA_CLASS_BASE
+ #ifndef V4L2_CID_IRIS_ABSOLUTE
+ #define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
+ #endif
++#endif
+ 
+ #ifndef V4L2_PIX_FMT_Y10
+ #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ')
+@@ -665,9 +679,13 @@ bool CvCaptureCAM_V4L::convertableToRgb(
+     case V4L2_PIX_FMT_UYVY:
+     case V4L2_PIX_FMT_SBGGR8:
+     case V4L2_PIX_FMT_SN9C10X:
++#ifdef V4L2_PIX_FMT_SGBRG8
+     case V4L2_PIX_FMT_SGBRG8:
++#endif
+     case V4L2_PIX_FMT_RGB24:
++#ifdef V4L2_PIX_FMT_Y16
+     case V4L2_PIX_FMT_Y16:
++#endif
+     case V4L2_PIX_FMT_Y10:
+     case V4L2_PIX_FMT_GREY:
+     case V4L2_PIX_FMT_BGR24:
+@@ -715,7 +733,9 @@ void CvCaptureCAM_V4L::v4l2_create_frame
+             channels = 1;
+             size.height = size.height * 3 / 2; // "1.5" channels
+             break;
++#ifdef V4L2_PIX_FMT_Y16
+         case V4L2_PIX_FMT_Y16:
++#endif
+         case V4L2_PIX_FMT_Y12:
+         case V4L2_PIX_FMT_Y10:
+             depth = IPL_DEPTH_16U;
+@@ -1729,6 +1749,7 @@ void CvCaptureCAM_V4L::convertToRgb(cons
+     case V4L2_PIX_FMT_RGB24:
+         cv::cvtColor(cv::Mat(imageSize, CV_8UC3, start), destination, COLOR_RGB2BGR);
+         return;
++#ifdef V4L2_PIX_FMT_Y16
+     case V4L2_PIX_FMT_Y16:
+     {
+         cv::Mat temp(imageSize, CV_8UC1, buffers[MAX_V4L_BUFFERS].memories[MEMORY_RGB].start);
+@@ -1750,6 +1771,7 @@ void CvCaptureCAM_V4L::convertToRgb(cons
+         cv::cvtColor(temp, destination, COLOR_GRAY2BGR);
+         return;
+     }
++#endif
+     case V4L2_PIX_FMT_GREY:
+         cv::cvtColor(cv::Mat(imageSize, CV_8UC1, start), destination, COLOR_GRAY2BGR);
+         break;
+@@ -1866,8 +1888,10 @@ static inline int capPropertyToV4L2(int 
+         return -1;
+     case cv::CAP_PROP_FOURCC:
+         return -1;
++#ifdef V4L2_CID_MPEG_VIDEO_B_FRAMES
+     case cv::CAP_PROP_FRAME_COUNT:
+         return V4L2_CID_MPEG_VIDEO_B_FRAMES;
++#endif
+     case cv::CAP_PROP_FORMAT:
+         return -1;
+     case cv::CAP_PROP_MODE:
+@@ -1882,8 +1906,10 @@ static inline int capPropertyToV4L2(int 
+         return V4L2_CID_HUE;
+     case cv::CAP_PROP_GAIN:
+         return V4L2_CID_GAIN;
++#ifdef V4L2_CID_EXPOSURE_ABSOLUTE
+     case cv::CAP_PROP_EXPOSURE:
+         return V4L2_CID_EXPOSURE_ABSOLUTE;
++#endif
+     case cv::CAP_PROP_CONVERT_RGB:
+         return -1;
+     case cv::CAP_PROP_WHITE_BALANCE_BLUE_U:
+@@ -1894,8 +1920,10 @@ static inline int capPropertyToV4L2(int 
+         return -1;
+     case cv::CAP_PROP_SHARPNESS:
+         return V4L2_CID_SHARPNESS;
++#ifdef V4L2_CID_EXPOSURE_AUTO
+     case cv::CAP_PROP_AUTO_EXPOSURE:
+         return V4L2_CID_EXPOSURE_AUTO;
++#endif
+     case cv::CAP_PROP_GAMMA:
+         return V4L2_CID_GAMMA;
+     case cv::CAP_PROP_TEMPERATURE:
+@@ -1906,34 +1934,54 @@ static inline int capPropertyToV4L2(int 
+         return -1;
+     case cv::CAP_PROP_WHITE_BALANCE_RED_V:
+         return V4L2_CID_RED_BALANCE;
++#ifdef V4L2_CID_ZOOM_ABSOLUTE
+     case cv::CAP_PROP_ZOOM:
+         return V4L2_CID_ZOOM_ABSOLUTE;
++#endif
++#ifdef V4L2_CID_FOCUS_ABSOLUTE
+     case cv::CAP_PROP_FOCUS:
+         return V4L2_CID_FOCUS_ABSOLUTE;
++#endif
+     case cv::CAP_PROP_GUID:
+         return -1;
++#ifdef V4L2_CID_ISO_SENSITIVITY
+     case cv::CAP_PROP_ISO_SPEED:
+         return V4L2_CID_ISO_SENSITIVITY;
++#endif
+     case cv::CAP_PROP_BACKLIGHT:
+         return V4L2_CID_BACKLIGHT_COMPENSATION;
++#ifdef V4L2_CID_PAN_ABSOLUTE
+     case cv::CAP_PROP_PAN:
+         return V4L2_CID_PAN_ABSOLUTE;
++#endif
++#ifdef V4L2_CID_TILT_ABSOLUTE
+     case cv::CAP_PROP_TILT:
+         return V4L2_CID_TILT_ABSOLUTE;
++#endif
++#ifdef V4L2_CID_ROTATE
+     case cv::CAP_PROP_ROLL:
+         return V4L2_CID_ROTATE;
++#endif
++#ifdef V4L2_CID_IRIS_ABSOLUTE
+     case cv::CAP_PROP_IRIS:
+         return V4L2_CID_IRIS_ABSOLUTE;
++#endif
+     case cv::CAP_PROP_SETTINGS:
+         return -1;
+     case cv::CAP_PROP_BUFFERSIZE:
+         return -1;
++#ifdef V4L2_CID_FOCUS_AUTO
+     case cv::CAP_PROP_AUTOFOCUS:
+         return V4L2_CID_FOCUS_AUTO;
++#endif
++#ifdef V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT
+     case cv::CAP_PROP_SAR_NUM:
+         return V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT;
++#endif
++#ifdef V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH
+     case cv::CAP_PROP_SAR_DEN:
+         return V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH;
++#endif
+     case CAP_PROP_AUTO_WB:
+         return V4L2_CID_AUTO_WHITE_BALANCE;
+     case CAP_PROP_WB_TEMPERATURE:


Home | Main Index | Thread Index | Old Index