Skip to content

Commit 176f3e5

Browse files
authored
Update OpenCV-4-5-5.sh
1 parent 479eff0 commit 176f3e5

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

OpenCV-4-5-5.sh

+43-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
#!/bin/bash
22
set -e
3-
echo "Installing OpenCV 4.5.5 on your Raspberry Pi 64-bit OS"
3+
install_opencv () {
4+
echo ""
5+
case `cat /etc/debian_version` in
6+
10*) echo "Detecting Debian 10, Buster. "
7+
;;
8+
11*) echo "Detecting Debian 11, Bullseye. "
9+
;;
10+
12*) echo "Detecting Debian 12, Bookworm. "
11+
;;
12+
esac
13+
echo ""
14+
echo "Installing OpenCV 4.5.5"
415
echo "It will take minimal 2.0 hour !"
516
cd ~
617
# install the dependencies
@@ -12,12 +23,20 @@ sudo apt-get install -y libgstreamer1.0-dev gstreamer1.0-gtk3
1223
sudo apt-get install -y libgstreamer-plugins-base1.0-dev gstreamer1.0-gl
1324
sudo apt-get install -y libxvidcore-dev libx264-dev
1425
sudo apt-get install -y python3-dev python3-numpy python3-pip
15-
sudo apt-get install -y libtbb2 libtbb-dev libdc1394-22-dev
1626
sudo apt-get install -y libv4l-dev v4l-utils
1727
sudo apt-get install -y libopenblas-dev libatlas-base-dev libblas-dev
1828
sudo apt-get install -y liblapack-dev gfortran libhdf5-dev
1929
sudo apt-get install -y libprotobuf-dev libgoogle-glog-dev libgflags-dev
2030
sudo apt-get install -y protobuf-compiler
31+
#get TBB
32+
case `cat /etc/debian_version` in
33+
10*) sudo apt-get install -y libtbb2 libtbb-dev libdc1394-22-dev
34+
;;
35+
11*) sudo apt-get install -y libtbb2 libtbb-dev libdc1394-22-dev
36+
;;
37+
12*) sudo apt-get install -y libtbbmalloc2 libtbb-dev
38+
;;
39+
esac
2140

2241
# download the latest version
2342
cd ~
@@ -75,3 +94,25 @@ sudo apt-get update
7594

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

0 commit comments

Comments
 (0)