Difference between revisions of "OpenCV"

From BITPlan Wiki
Jump to navigation Jump to search
 
(20 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
{{:Self_Driving_RC_Car/Links}}
 +
 
OpenCV is a computer vision library written in C++. Binding for Java, Python and other environments are available.
 
OpenCV is a computer vision library written in C++. Binding for Java, Python and other environments are available.
 
= Links =
 
= Links =
Line 4: Line 6:
 
* https://en.wikipedia.org/wiki/OpenCV
 
* https://en.wikipedia.org/wiki/OpenCV
 
* https://docs.opencv.org/
 
* https://docs.opencv.org/
= Find Chessboard corner examples =
+
= Tutorial =
see https://gitter.im/play-chess-with-a-webcam/community
+
<pdf>https://readthedocs.org/projects/opencv-java-tutorials/downloads/pdf/latest/</pdf>
[[File:corners004-7x7.jpg|600px]]
+
 
[[File:corners001-7x7.jpg|600px]]
+
= Issues =
[[File:corners013-7x5.jpg|600px]]
+
see e.g. https://github.com/opencv/opencv/issues/16431
[[File:image001-corners-7x7.jpg|400px]][[File:image002-corners-5x5.jpg|400px]][[File:image003-corners-4x5.jpg|400px]][[File:image004-corners-7x7.jpg|400px]][[File:image005-corners-5x5.jpg|400px]][[File:image006-corners-5x5.jpg|400px]][[File:image007-corners-5x5.jpg|400px]][[File:image008-corners-7x7.jpg|400px]][[File:image009-corners-7x7.jpg|400px]][[File:image010-corners-6x7.jpg|400px]][[File:image011-corners-7x7.jpg|400px]][[File:image012-corners-4x6.jpg|400px]][[File:image013-corners-5x7.jpg|400px]]
+
 
 +
== OpenCV Version ==
 +
* https://stackoverflow.com/questions/11030640/how-to-determine-opencv-version
 +
 
 +
== OpenCV VideoWriter ==
 +
see https://github.com/rc-dukes/dukes/issues/48
 +
<pre>
 +
OpenCV: FFMPEG: tag 0x67706a6d/'mjpg' is not supported with codec id 7 and format 'mpeg / MPEG-1 Systems / MPEG program stream'
 +
</pre>
 +
* https://stackoverflow.com/questions/34024041/writing-x264-from-opencv-3-with-ffmpeg-on-linux
 +
* https://answers.opencv.org/question/120081/videowriter-recording-mp4-x264-opencv-31/
 +
* https://stackoverflow.com/questions/10605163/opencv-videowriter-under-osx-producing-no-output
 +
* http://www.fourcc.org/codecs.php
 +
* https://stackoverflow.com/questions/24195926/opencv-write-webcam-output-to-avi-file
 +
 
 +
== SIGILL when calling findChessBoardCorners on MacOS 10.13.6 with macports opencv ==
 +
=== crash ===
 +
<pre>
 +
reading: ./target/test-classes/cameramatrix/GOPR0032.jpg
 +
#
 +
# A fatal error has been detected by the Java Runtime Environment:
 +
#
 +
#  SIGILL (0x4) at pc=0x0000000141f4e8c6, pid=35515, tid=0x0000000000002503
 +
#
 +
# JRE version: Java(TM) SE Runtime Environment (8.0_191-b12) (build 1.8.0_191-b12)
 +
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.191-b12 mixed mode bsd-amd64 compressed oops)
 +
# Problematic frame:
 +
# C  [libopencv_imgproc.3.4.dylib+0x2088c6] cv::Ptr<cv::FilterEngine> cv::makePtr<cv::FilterEngine, cv::Ptr<cv::BaseFilter>, cv::Ptr<cv::BaseRowFilter>, cv::Ptr<cv::BaseColumnFilter>, int, int, int, int>(cv::Ptr<cv::BaseFilter> const&, cv::Ptr<cv::BaseRowFilter> const&, cv::Ptr<cv::BaseColumnFilter> const&, int const&, int const&, int const&, int const&)+0x4e
 +
#
 +
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
 +
#
 +
# An error report file with more information is saved as:
 +
# /Users/wf/Documents/workspace/dukes/rc-camera-matrix/hs_err_pid35515.log
 +
#
 +
</pre>
 +
=== log ===
 +
<pre>
 +
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
 +
C  [libopencv_imgproc.3.4.dylib+0x2088c6] cv::Ptr<cv::FilterEngine> cv::makePtr<cv::FilterEngine, cv::Ptr<cv::BaseFilter>, cv::Ptr<cv::BaseRowFilter>, cv::Ptr<cv::BaseColumnFilter>, int, int, int, int>(cv::Ptr<cv::BaseFilter> const&, cv::Ptr<cv::BaseRowFilter> const&, cv::Ptr<cv::BaseColumnFilter> const&, int const&, int const&, int const&, int const&)+0x4e
 +
C  [libopencv_imgproc.3.4.dylib+0x1b07c] cv::cpu_baseline::createBoxFilter(int, int, cv::Size_<int>, cv::Point_<int>, bool, int)+0x151
 +
[libopencv_imgproc.3.4.dylib+0x1b6e3]  cv::createBoxFilter(int, int, cv::Size_<int>, cv::Point_<int>, bool, int)+0xb0
 +
[libopencv_imgproc.3.4.dylib+0x1b9b5]  cv::boxFilter(cv::_InputArray const&, cv::_OutputArray const&, int, cv::Size_<int>, cv::Point_<int>, bool, int)+0x287
 +
C  [libopencv_imgproc.3.4.dylib+0x1e09bc] cv::adaptiveThreshold(cv::_InputArray const&, cv::_OutputArray const&, double, int, int, int, double)+0x470
 +
C  [libopencv_calib3d.3.4.dylib+0x7ad6] cv::findChessboardCorners(cv::_InputArray const&, cv::Size_<int>, cv::_OutputArray const&, int)+0x1626
 +
[libopencv_java343.dylib+0x7de02]  Java_org_opencv_calib3d_Calib3d_findChessboardCorners_11+0x6a
 +
j  org.opencv.calib3d.Calib3d.findChessboardCorners_1(JDDJ)Z+0
 +
j  org.opencv.calib3d.Calib3d.findChessboardCorners(Lorg/opencv/core/Mat;Lorg/opencv/core/Size;Lorg/opencv/core/MatOfPoint2f;)Z+18
 +
j  nl.vaneijndhoven.dukes.camera.matrix.CameraMatrix.findCorners(Lorg/opencv/core/Mat;IILorg/opencv/core/MatOfPoint2f;)Z+14
 +
</pre>
 +
=== diagnosis ===
 +
* https://stackoverflow.com/questions/57352670/how-to-fix-handle-opencv-crash-in-calib3d-findchessboardcorners-method-android
 +
=== therapy ===
 +
ask question - bug?
 +
* https://answers.opencv.org/question/224739/libopencv_imgproc34dylib-crashes-on-macos-10136-with-macpro-2010/
 +
 
 +
= Crash on tcp connection open =
 +
<pre>
 +
#
 +
# A fatal error has been detected by the Java Runtime Environment:
 +
#
 +
#  SIGSEGV (0xb) at pc=0x00000001227bae5e, pid=58965, tid=0x0000000000018503
 +
#
 +
# JRE version: Java(TM) SE Runtime Environment (8.0_152-b16) (build 1.8.0_152-b16)
 +
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.152-b16 mixed mode bsd-amd64 compressed oops)
 +
# Problematic frame:
 +
# [tcp @ 0x7f7f41780780] Connection to tcp://picarford:8090 failed: Connection refused
 +
C  [libopencv_videoio.3.4.dylib+0x25e5e] AutoLock::~AutoLock()+0x4
 +
#
 +
# [thread 80387 also had an error]
 +
Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
 +
#
 +
# An error report file with more information is saved as:
 +
# /Users/wf/Documents/workspace/dukes/rc-server/hs_err_pid58965.log
 +
OpenCV: Couldn't read video stream from file "http://picarford:8090/stream/video.mjpeg"
 +
[ERROR:1] VIDEOIO(cvCreateFileCapture_Images(filename.c_str())): raised OpenCV exception:
 +
 
 +
OpenCV(3.4.8) /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_graphics_opencv/opencv/work/opencv-3.4.8/modules/videoio/src/cap_images.cpp:246: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): http://picarford:8090/stream/video.mjpeg in function 'icvExtractPattern'
 +
 
 +
RAX=0x00000001227b8200: _ZN16CvCapture_FFMPEG4openEPKc+0x360 in /opt/local/lib/libopencv_videoio.3.4.dylib at 0x0000000122795000
 +
RBX=0x00007f7f4a255c70 is an unknown value
 +
RCX=0x00007fff7a04609a: poll+0xa in /usr/lib/system/libsystem_kernel.dylib at 0x00007fff7a028000
 +
RDX=0x0000000000000000 is an unknown value
 +
</pre>
 +
 
 +
= Macports installation =
 +
<source lang='bash'>
 +
sudo port install opencv +java
 +
</source>
 +
= What Links Here =
 +
{{WhatLinksHere}}

Latest revision as of 14:09, 30 November 2020

Click here to comment see Self Driving RC Car

OpenCV is a computer vision library written in C++. Binding for Java, Python and other environments are available.

Links

Tutorial

load PDF

Issues

see e.g. https://github.com/opencv/opencv/issues/16431

OpenCV Version

OpenCV VideoWriter

see https://github.com/rc-dukes/dukes/issues/48

OpenCV: FFMPEG: tag 0x67706a6d/'mjpg' is not supported with codec id 7 and format 'mpeg / MPEG-1 Systems / MPEG program stream'

SIGILL when calling findChessBoardCorners on MacOS 10.13.6 with macports opencv

crash

reading: ./target/test-classes/cameramatrix/GOPR0032.jpg
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x0000000141f4e8c6, pid=35515, tid=0x0000000000002503
#
# JRE version: Java(TM) SE Runtime Environment (8.0_191-b12) (build 1.8.0_191-b12)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.191-b12 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [libopencv_imgproc.3.4.dylib+0x2088c6]  cv::Ptr<cv::FilterEngine> cv::makePtr<cv::FilterEngine, cv::Ptr<cv::BaseFilter>, cv::Ptr<cv::BaseRowFilter>, cv::Ptr<cv::BaseColumnFilter>, int, int, int, int>(cv::Ptr<cv::BaseFilter> const&, cv::Ptr<cv::BaseRowFilter> const&, cv::Ptr<cv::BaseColumnFilter> const&, int const&, int const&, int const&, int const&)+0x4e
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/wf/Documents/workspace/dukes/rc-camera-matrix/hs_err_pid35515.log
#

log

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libopencv_imgproc.3.4.dylib+0x2088c6]  cv::Ptr<cv::FilterEngine> cv::makePtr<cv::FilterEngine, cv::Ptr<cv::BaseFilter>, cv::Ptr<cv::BaseRowFilter>, cv::Ptr<cv::BaseColumnFilter>, int, int, int, int>(cv::Ptr<cv::BaseFilter> const&, cv::Ptr<cv::BaseRowFilter> const&, cv::Ptr<cv::BaseColumnFilter> const&, int const&, int const&, int const&, int const&)+0x4e
C  [libopencv_imgproc.3.4.dylib+0x1b07c]  cv::cpu_baseline::createBoxFilter(int, int, cv::Size_<int>, cv::Point_<int>, bool, int)+0x151
C  [libopencv_imgproc.3.4.dylib+0x1b6e3]  cv::createBoxFilter(int, int, cv::Size_<int>, cv::Point_<int>, bool, int)+0xb0
C  [libopencv_imgproc.3.4.dylib+0x1b9b5]  cv::boxFilter(cv::_InputArray const&, cv::_OutputArray const&, int, cv::Size_<int>, cv::Point_<int>, bool, int)+0x287
C  [libopencv_imgproc.3.4.dylib+0x1e09bc]  cv::adaptiveThreshold(cv::_InputArray const&, cv::_OutputArray const&, double, int, int, int, double)+0x470
C  [libopencv_calib3d.3.4.dylib+0x7ad6]  cv::findChessboardCorners(cv::_InputArray const&, cv::Size_<int>, cv::_OutputArray const&, int)+0x1626
C  [libopencv_java343.dylib+0x7de02]  Java_org_opencv_calib3d_Calib3d_findChessboardCorners_11+0x6a
j  org.opencv.calib3d.Calib3d.findChessboardCorners_1(JDDJ)Z+0
j  org.opencv.calib3d.Calib3d.findChessboardCorners(Lorg/opencv/core/Mat;Lorg/opencv/core/Size;Lorg/opencv/core/MatOfPoint2f;)Z+18
j  nl.vaneijndhoven.dukes.camera.matrix.CameraMatrix.findCorners(Lorg/opencv/core/Mat;IILorg/opencv/core/MatOfPoint2f;)Z+14

diagnosis

therapy

ask question - bug?

Crash on tcp connection open

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00000001227bae5e, pid=58965, tid=0x0000000000018503
#
# JRE version: Java(TM) SE Runtime Environment (8.0_152-b16) (build 1.8.0_152-b16)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.152-b16 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# [tcp @ 0x7f7f41780780] Connection to tcp://picarford:8090 failed: Connection refused
C  [libopencv_videoio.3.4.dylib+0x25e5e]  AutoLock::~AutoLock()+0x4
#
# [thread 80387 also had an error]
Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/wf/Documents/workspace/dukes/rc-server/hs_err_pid58965.log
OpenCV: Couldn't read video stream from file "http://picarford:8090/stream/video.mjpeg"
[ERROR:1] VIDEOIO(cvCreateFileCapture_Images(filename.c_str())): raised OpenCV exception:

OpenCV(3.4.8) /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_graphics_opencv/opencv/work/opencv-3.4.8/modules/videoio/src/cap_images.cpp:246: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): http://picarford:8090/stream/video.mjpeg in function 'icvExtractPattern'

RAX=0x00000001227b8200: _ZN16CvCapture_FFMPEG4openEPKc+0x360 in /opt/local/lib/libopencv_videoio.3.4.dylib at 0x0000000122795000
RBX=0x00007f7f4a255c70 is an unknown value
RCX=0x00007fff7a04609a: poll+0xa in /usr/lib/system/libsystem_kernel.dylib at 0x00007fff7a028000
RDX=0x0000000000000000 is an unknown value

Macports installation

sudo port install opencv +java

What Links Here