Giter Club home page Giter Club logo

mastering-opencv-4-third-edition's Introduction

Mastering OpenCV 4 - Third Edition

Mastering OpenCV 4 - Third Edition

This is the code repository for Mastering OpenCV 4 - Third Edition, published by Packt.

A comprehensive guide to building computer vision and image processing applications with C++

What is this book about?

Mastering OpenCV, now in its third edition, targets computer vision engineers taking their first steps toward mastering OpenCV. Keeping the mathematical formulations to a solid but bare minimum, the book delivers complete projects from ideation to running code, targeting current hot topics in computer vision such as face recognition, landmark detection and pose estimation, and number recognition with deep convolutional networks.

This book covers the following exciting features:

  • Build real-world computer vision problems with working OpenCV code samples
  • Uncover best practices in engineering and maintaining OpenCV projects
  • Explore algorithmic design approaches for complex computer vision tasks
  • Work with OpenCV’s most updated API (v4.0.0)through projects
  • Understand 3D scene reconstruction and Structure from Motion (SfM)
  • Study camera calibration and overlay AR using the ArUco Module

If you feel this book is for you, get your copy today!

https://www.packtpub.com/

Instructions and Navigations

All of the code is organized into folders. For example, Chapter02.

The code will look like the following:

Mat bigImg; 
resize(smallImg, bigImg, size, 0,0, INTER_LINEAR); 
dst.setTo(0); 
bigImg.copyTo(dst, mask);

Following is what you need for this book: This book is for those who have a basic knowledge of OpenCV and are competent C++ programmers. You need to have an understanding of some of the more theoretical/mathematical concepts, as we move quite quickly throughout the book.

With the following software and hardware list you can run all code files present in the book (Chapter 1-10).

Software and Hardware List

Each chapter folder contains individual instruction on building and running the code. Chapter 10: Avoiding Common Pitfalls in OpenCV, is without code.

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.

Related products

  • Learn OpenCV 4 By Building Projects - Second Edition [Packt] [Amazon]

  • Hands-On GPU-Accelerated Computer Vision with OpenCV and CUDA [Packt] [Amazon]

Get to Know the Authors

Roy Shilkrot is an assistant professor of computer science at Stony Brook University, where he leads the Human Interaction group. Dr. Shilkrot's research is in computer vision, human-computer interfaces, and the cross-over between these two domains, funded by US federal, New York State, and industry grants. Dr. Shilkrot graduated from the Massachusetts Institute of Technology (MIT) with a PhD, and has authored more than 25 peer-reviewed papers published at premier computer science conferences, such as CHI and SIGGRAPH, as well as in leading academic journals such as ACM Transaction on Graphics (TOG) and ACM Transactions on Computer-Human Interaction (ToCHI). Dr. Shilkrot is also a co-inventor of several patented technologies, a co-author of a number of books, serves on the scientific advisory board of numerous start-up companies, and has over 10 years of experience as an engineer and an entrepreneur.

David Millan Escriva was eight years old when he wrote his first program on an 8086 PC in Basic, which enabled the 2D plotting of basic equations. In 2005, he finished his studies in IT through the Universitat Politécnica de Valenci with honors in human-computer interaction supported by computer vision with OpenCV (v0.96). He had a final project based on this subject and published it on HCI Spanish congress. He has worked with Blender, an open source, 3D software project, and worked on his first commercial movie, Plumiferos - Aventuras voladoras, as a computer graphics software developer. David now has more than 10 years of experience in IT, with experience in computer vision, computer graphics, and pattern recognition, working with different projects and start-ups, applying his knowledge of computer vision, optical character recognition, and augmented reality. He is the author of the DamilesBlog blog, where he publishes research articles and tutorials about OpenCV, computer vision in general, and optical character recognition algorithms.

Other books by the authors

Mastering OpenCV 3 - Second Edition

Mastering OpenCV with Practical Computer Vision Projects

Suggestions and Feedback

Click here if you have any feedback or suggestions.

mastering-opencv-4-third-edition's People

Contributors

damiles avatar packt-itservice avatar royshil avatar zeeyan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mastering-opencv-4-third-edition's Issues

Errors building/using OpenCV.js

Hi,

I've tried to build OpenCV.js and ran into errors:

python ./platforms/js/build_js.py build_js_test --emscripten_dir ../emsdk/upstream/emscripten
Args: Namespace(build_dir='build_js_test', build_doc=False, build_flags=None, build_perf=False, build_test=False, build_wasm=False, build_wasm_intrin_test=False, clean_build_dir=False, cmake_option=None, config='/Users/George/Downloads/Grouped/cv/opencv/platforms/js/opencv_js.config.py', config_only=False, disable_wasm=False, emscripten_dir='../emsdk/upstream/emscripten', enable_exception=False, opencv_dir='/Users/George/Downloads/Grouped/cv/opencv', simd=False, skip_config=False, threads=False)
Check dir /Users/George/Downloads/Grouped/cv/opencv/build_js_test (create: True, clean: False)
Check dir /Users/George/Downloads/Grouped/cv/opencv (create: False, clean: False)
Check dir /Users/George/Downloads/Grouped/cv/emsdk/upstream/emscripten (create: False, clean: False)
=====
===== Config OpenCV.js build for default target
=====
Executing: ['cmake', '-DENABLE_PIC=FALSE', '-DCMAKE_BUILD_TYPE=Release', "-DCMAKE_TOOLCHAIN_FILE='/Users/George/Downloads/Grouped/cv/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake'", "-DCPU_BASELINE=''", "-DCPU_DISPATCH=''", '-DCV_TRACE=OFF', '-DBUILD_SHARED_LIBS=OFF', '-DWITH_1394=OFF', '-DWITH_ADE=OFF', '-DWITH_VTK=OFF', '-DWITH_EIGEN=OFF', '-DWITH_FFMPEG=OFF', '-DWITH_GSTREAMER=OFF', '-DWITH_GTK=OFF', '-DWITH_GTK_2_X=OFF', '-DWITH_IPP=OFF', '-DWITH_JASPER=OFF', '-DWITH_JPEG=OFF', '-DWITH_WEBP=OFF', '-DWITH_OPENEXR=OFF', '-DWITH_OPENGL=OFF', '-DWITH_OPENVX=OFF', '-DWITH_OPENNI=OFF', '-DWITH_OPENNI2=OFF', '-DWITH_PNG=OFF', '-DWITH_TBB=OFF', '-DWITH_TIFF=OFF', '-DWITH_V4L=OFF', '-DWITH_OPENCL=OFF', '-DWITH_OPENCL_SVM=OFF', '-DWITH_OPENCLAMDFFT=OFF', '-DWITH_OPENCLAMDBLAS=OFF', '-DWITH_GPHOTO2=OFF', '-DWITH_LAPACK=OFF', '-DWITH_ITT=OFF', '-DWITH_QUIRC=OFF', '-DBUILD_ZLIB=ON', '-DBUILD_opencv_apps=OFF', '-DBUILD_opencv_calib3d=ON', '-DBUILD_opencv_dnn=ON', '-DBUILD_opencv_features2d=ON', '-DBUILD_opencv_flann=ON', '-DBUILD_opencv_gapi=OFF', '-DBUILD_opencv_ml=OFF', '-DBUILD_opencv_photo=ON', '-DBUILD_opencv_imgcodecs=OFF', '-DBUILD_opencv_shape=OFF', '-DBUILD_opencv_videoio=OFF', '-DBUILD_opencv_videostab=OFF', '-DBUILD_opencv_highgui=OFF', '-DBUILD_opencv_superres=OFF', '-DBUILD_opencv_stitching=OFF', '-DBUILD_opencv_java=OFF', '-DBUILD_opencv_java_bindings_generator=OFF', '-DBUILD_opencv_js=ON', '-DBUILD_opencv_python2=OFF', '-DBUILD_opencv_python3=OFF', '-DBUILD_opencv_python_bindings_generator=OFF', '-DBUILD_EXAMPLES=OFF', '-DBUILD_PACKAGE=OFF', '-DBUILD_TESTS=OFF', '-DBUILD_PERF_TESTS=OFF', '-DBUILD_DOCS=OFF', '-DWITH_PTHREADS_PF=OFF', '-DCV_ENABLE_INTRINSICS=OFF', '-DBUILD_WASM_INTRIN_TESTS=OFF', "-DCMAKE_C_FLAGS='-s USE_PTHREADS=0 '", "-DCMAKE_CXX_FLAGS='-s USE_PTHREADS=0 '", '/Users/George/Downloads/Grouped/cv/opencv']
Re-run cmake no build system arguments
CMake Error at /Users/George/Downloads/Grouped/cv/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake:131 (message):
  Failed to fetch compiler version information with command
  "'/Users/George/Downloads/Grouped/cv/emsdk/upstream/emscripten/emcc' -v"!
  Process returned with error code SIGTRAP.
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.18.2/share/cmake/Modules/CMakeDetermineSystem.cmake:93 (include)
  CMakeLists.txt:106 (enable_language)


CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
  File "./platforms/js/build_js.py", line 270, in <module>
    builder.config()
  File "./platforms/js/build_js.py", line 192, in config
    execute(cmd)
  File "./platforms/js/build_js.py", line 23, in execute
    raise Fail("Child returned: %s" % retcode)
__main__.Fail: Child returned: 1

I've tried running the same command separaterly:

cmake -DENABLE_PIC=FALSE -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE='/Users/George/Downloads/Grouped/cv/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake' -DCPU_BASELINE='' -DCPU_DISPATCH='' -DCV_TRACE=OFF -DBUILD_SHARED_LIBS=OFF -DWITH_1394=OFF -DWITH_ADE=OFF -DWITH_VTK=OFF -DWITH_EIGEN=OFF -DWITH_FFMPEG=OFF -DWITH_GSTREAMER=OFF -DWITH_GTK=OFF -DWITH_GTK_2_X=OFF -DWITH_IPP=OFF -DWITH_JASPER=OFF -DWITH_JPEG=OFF -DWITH_WEBP=OFF -DWITH_OPENEXR=OFF -DWITH_OPENGL=OFF -DWITH_OPENVX=OFF -DWITH_OPENNI=OFF -DWITH_OPENNI2=OFF -DWITH_PNG=OFF -DWITH_TBB=OFF -DWITH_TIFF=OFF -DWITH_V4L=OFF -DWITH_OPENCL=OFF -DWITH_OPENCL_SVM=OFF -DWITH_OPENCLAMDFFT=OFF -DWITH_OPENCLAMDBLAS=OFF -DWITH_GPHOTO2=OFF -DWITH_LAPACK=OFF -DWITH_ITT=OFF -DWITH_QUIRC=OFF -DBUILD_ZLIB=ON -DBUILD_opencv_apps=OFF -DBUILD_opencv_calib3d=ON -DBUILD_opencv_dnn=ON -DBUILD_opencv_features2d=ON -DBUILD_opencv_flann=ON -DBUILD_opencv_gapi=OFF -DBUILD_opencv_ml=OFF -DBUILD_opencv_photo=ON -DBUILD_opencv_imgcodecs=OFF -DBUILD_opencv_shape=OFF -DBUILD_opencv_videoio=OFF -DBUILD_opencv_videostab=OFF -DBUILD_opencv_highgui=OFF -DBUILD_opencv_superres=OFF -DBUILD_opencv_stitching=OFF -DBUILD_opencv_java=OFF -DBUILD_opencv_java_bindings_generator=OFF -DBUILD_opencv_js=ON -DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=OFF -DBUILD_opencv_python_bindings_generator=OFF -DBUILD_EXAMPLES=OFF -DBUILD_PACKAGE=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_DOCS=OFF -DWITH_PTHREADS_PF=OFF -DCV_ENABLE_INTRINSICS=OFF -DBUILD_WASM_INTRIN_TESTS=OFF -DCMAKE_C_FLAGS='-s USE_PTHREADS=0 ' -DCMAKE_CXX_FLAGS='-s USE_PTHREADS=0 ' /Users/George/Downloads/Grouped/cv/opencv
CMake Error at CMakeLists.txt:11 (message):
  

  FATAL: In-source builds are not allowed.

         You should create a separate directory for build files.



-- Configuring incomplete, errors occurred!

Looking at the official OpenCV.js setup I've noticed there's a docker version which I've tried:

docker run --rm --workdir /code -v "$PWD":/code "trzeci/emscripten:latest" python ./platforms/js/build_js.py build_js_docker --enable_exception

It did generate opencv.js (and also opencv_js.js which is confusing), but when I tried to use it on a web page I got this error:

Uncaught (in promise) 
BindingError
message: "Cannot register public name 'IntVector' twice"
name: "BindingError"
stack: "BindingError: Cannot register public name 'IntVector' twice↵    at BindingError.<anonymous> (http://127.0.0.1:8696/libraries/opencv.js:31:8081873)↵    at new BindingError (eval at createNamedFunction (http://127.0.0.1:8696/libraries/opencv.js:31:8081582), <anonymous>:4:34)↵    at throwBindingError (http://127.0.0.1:8696/libraries/opencv.js:31:8087018)↵    at exposePublicSymbol (http://127.0.0.1:8696/libraries/opencv.js:31:8092550)↵    at __embind_register_class (http://127.0.0.1:8696/libraries/opencv.js:31:8102881)↵    at <anonymous>:wasm-function[103]:0xdbd2↵    at <anonymous>:wasm-function[102]:0xb853↵    at __wasm_call_ctors (<anonymous>:wasm-function[57]:0xa1a3)↵    at Module.___wasm_call_ctors (http://127.0.0.1:8696/libraries/opencv.js:31:8147790)↵    at func (http://127.0.0.1:8696/libraries/opencv.js:31:8005045)"
__proto__: Error

I'm not sure how to proceed from here.

How can I compile OpenCV.js to a usable script ?

Many thanks,
George

Chapter 4 code has not been upgraded to OpenCV 4

Hi,

Many C++ files in Chapter 4 still have OpenCV C-style, and are no more compatible with OpenCV 4.

Issues concern such features as :

  • include files
    For example : <cv.h> ...
  • processing flags :
    For example : CV_BGR2GRAY --> cv::COLOR_BGR2GRAY or CV_THRESH_BINARY_INV --> cv::ThresholdTypes::THRESH_BINARY_INV
  • etc ...

I haven't worked with the other chapters of the book yet, but it seems that there is old-style code in Chapter 7 too.

Furthermore, I had to modify CMakeList.txt file to be able to generate the .sln project under Windows 10 (issue with conanbuild).
Seems that at least Chapter 4 content has not been upgraded on github.

Best regards,

undefined reference to 'cv::imwrite

Hello, when I compile the code, I got the following error

Chapter_07/app/src/main/cpp/native-lib.cpp:130: error: undefined reference to 'cv::imwrite(cv::String const&, cv::_InputArray const&, std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&)'

what should I change?

Basic image stitching not finding enough overlap

Hey @royshil, I love the chapter on iOS and opencv. It brought a number of great technologies together.

I'm stuck on on the performance of stitcher. I'm aware that we can change the threshold for confidence when the pano runs. However, for basic images such as the ones I shared on this OpenCV post, the algorithm doesn't work. There's considerable overlap of the images, so I assume there's setting I haven't figured out yet.

Could you take a look please? Python code for notebook testing included in the post.

https://forum.opencv.org/t/improve-stitch-pano-performance/6995

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.