From b65f8c1b57d6c48b5a9664ff035a10d086ea1ec8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Vallv=C3=A9=20Navarro?= <jvallve@iri.upc.edu>
Date: Thu, 27 Jan 2022 18:24:27 +0100
Subject: [PATCH] Update ReadMe.md with patches found in ubuntu 20.04

---
 ReadMe.md | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/ReadMe.md b/ReadMe.md
index 1d6292e..d8a397e 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -23,13 +23,24 @@ sudo apt-get update
 sudo apt-get install libgtk2.0-dev pkg-config
 wget https://github.com/opencv/opencv/archive/3.3.0.zip -O temp.zip && unzip temp.zip && rm temp.zip
 cd opencv-3.3.0
-git clone https://github.com/opencv/opencv_contrib.git && cd opencv_contrib && git checkout 3.3.0 && cd ..
+git clone https://github.com/opencv/opencv_contrib.git
+cd opencv_contrib
+git checkout 3.3.0
+cd ..
+```
+In ubuntu 20.04 a [bug](https://stackoverflow.com/questions/56845909/invalid-conversion-error-in-cv2-file-while-installing-opencv-3-3-0-on-raspberry/56919661) has to be fixed before compiling:
+
+```sh
+sed -i 's/char\* str = PyString_AsString(obj)/const char\* str = PyString_AsString(obj)/g' modules/python/src2/cv2.cpp
+```
+Compilation has to be done disabling FFMPEG acording to [this bug](https://stackoverflow.com/questions/46884682/error-in-building-opencv-with-ffmpeg)
+```sh
 mkdir build && cd build
-cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D CMAKE_CXX_FLAGS="-fPIC -std=c++11" -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ..
+cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D CMAKE_CXX_FLAGS="-fPIC -std=c++11" -D OPENCV_EXTRA_MODULES_PATH=../ opencv_contrib/modules -D WITH_FFMPEG=OFF ..
 make -j4
 sudo make install
 ```
-    * NOTE: Check that opencv and `opencv_contrib` versions are the same.  
+NOTE: Check that `opencv` and `opencv_contrib` versions are the same.  
     
   * [YAML cpp](https://github.com/jbeder/yaml-cpp): Used to load parameters from YAML files. To install it run the following commands:
   
-- 
GitLab