Skip to content

Commit 880c208

Browse files
authored
Update OpenCV-4-5-0.sh
1 parent ee4a587 commit 880c208

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

OpenCV-4-5-0.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.0 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.0"
415
echo "It will take minimal 1.5 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 ~
@@ -76,3 +95,25 @@ sudo apt-get update
7695

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

0 commit comments

Comments
 (0)