Skip to content

Commit ee4a587

Browse files
authored
Update OpenCV-4-6-0.sh
1 parent 6a19ab7 commit ee4a587

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

OpenCV-4-6-0.sh

+46-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
#!/bin/bash
22
set -e
3-
echo "Installing OpenCV 4.6.0 on your Raspberry Pi 64-bit OS"
4-
echo "It will take minimal 2.0 hour !"
3+
install_opencv () {
4+
5+
echo ""
6+
7+
case `cat /etc/debian_version` in
8+
10*) echo "Detecting Debian 10, Buster. "
9+
;;
10+
11*) echo "Detecting Debian 11, Bullseye. "
11+
;;
12+
12*) echo "Detecting Debian 12, Bookworm. "
13+
;;
14+
esac
15+
16+
echo ""
17+
echo "Installing OpenCV 4.6.0"
18+
echo "It will take minimal 2 hour !"
519
cd ~
620
# install the dependencies
721
sudo apt-get install -y build-essential cmake git unzip pkg-config
@@ -12,13 +26,20 @@ sudo apt-get install -y libgstreamer1.0-dev gstreamer1.0-gtk3
1226
sudo apt-get install -y libgstreamer-plugins-base1.0-dev gstreamer1.0-gl
1327
sudo apt-get install -y libxvidcore-dev libx264-dev
1428
sudo apt-get install -y python3-dev python3-numpy python3-pip
15-
sudo apt-get install -y libtbb2 libtbb-dev libdc1394-22-dev
1629
sudo apt-get install -y libv4l-dev v4l-utils
1730
sudo apt-get install -y libopenblas-dev libatlas-base-dev libblas-dev
1831
sudo apt-get install -y liblapack-dev gfortran libhdf5-dev
1932
sudo apt-get install -y libprotobuf-dev libgoogle-glog-dev libgflags-dev
2033
sudo apt-get install -y protobuf-compiler
21-
34+
#get TBB
35+
case `cat /etc/debian_version` in
36+
10*) sudo apt-get install -y libtbb2 libtbb-dev libdc1394-22-dev
37+
;;
38+
11*) sudo apt-get install -y libtbb2 libtbb-dev libdc1394-22-dev
39+
;;
40+
12*) sudo apt-get install -y libtbbmalloc2 libtbb-dev
41+
;;
42+
esac
2243
# download the latest version
2344
cd ~
2445
sudo rm -rf opencv*
@@ -75,3 +96,24 @@ sudo apt-get update
7596

7697
echo "Congratulations!"
7798
echo "You've successfully installed OpenCV 4.6.0 on your Raspberry Pi 64-bit OS"
99+
}
100+
101+
cd ~
102+
103+
if [ -d ~/opencv/build ]; then
104+
echo " "
105+
echo "You have a directory ~/opencv/build on your disk."
106+
echo "Continuing the installation will replace this folder."
107+
echo " "
108+
109+
printf "Do you wish to continue (Y/n)?"
110+
read answer
111+
112+
if [ "$answer" != "${answer#[Nn]}" ] ;then
113+
echo "Leaving without installing OpenCV"
114+
else
115+
install_opencv
116+
fi
117+
else
118+
install_opencv
119+
fi

0 commit comments

Comments
 (0)