Module3. Unsuspected person detection - GachonCapstoneDesign/DoorWatcher GitHub Wiki

We use Raspberry Pi camera to do image processing and detect suspicious people through our algorithms.

First, to use OpenCV in raspberry pi, the following process is required.

1. Installing

You need to install the following OpenCV in the raspberry pi. First update the basic packages installed in the raspberry pi.

sudo apt-get update   
sudo apt-get upgrade  

The list below is a required package when using OpenCV.

build-essential
cmake
pkg-config
libjpeg-dev
libtiff5-dev
libjasper-dev
libpng12-dev
libavcodec-dev
libavformat-dev
libswscale-dev
libv4l-dev
libxvidcore-dev
libx264-dev
libgtk2.0-dev
libatlas-base-dev
gfortran
python2.7-dev
python3-dev

sudo apt-get install {Package name}

Now download the OpenCV and unzip it.

wget -O openCV2.4.9.zip http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv 2.4.9.zip/download
unzip openCV-2.4.9.zip  

If you do not have the unzip package, install it through sudo apt-get install unzip.

Now go to the folder where you unzipped and go through the following process.

cd openCV-2.4.9
cmake .
make -j4

'cmake' checks the packages installed on your system and automatically creates a Makefile for your build. Then builds through make -j4. Usually oepncv build time is very long. Once the build is finished, the installation will complete the installation of opencv.

sudo make install

When the installation is complete, type pkg-config --modversion opencv to verify the version.

motion detection

This code is now on the github.

  • Github. Click the hyperlink to go to the github repository.

When you run 'doorwatcher.py' in Python, it will take the first picture taken by the camera. When the image frame changes on the screen, it starts counting itself (set to count up to 100). When the motion disappears from the screen, the count is reset.

Videos

The following images are images that are operated using a notebook camera, not a Raspberry pi camera module.

Youtube

IMAGE ALT TEXT



[ ํ•œ๊ธ€ ์œ„ํ‚ค ]

๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ ์นด๋ฉ”๋ผ๋ฅผ ์ด์šฉํ•ด์„œ ์ด๋ฏธ์ง€ ํ”„๋กœ์„ธ์‹ฑ์„ ํ•˜๊ณ  ์ €ํฌ์˜ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ํ†ตํ•˜์—ฌ ์ˆ˜์ƒํ•œ ์‚ฌ๋žŒ์„ ๊ฐ์ง€ํ•ฉ๋‹ˆ๋‹ค.

๋จผ์ € ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด์—์„œ OpenCV ๋ฅผ ์‚ฌ์šฉํ™”๊ธฐ ์œ„ํ•ด์„  ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ณผ์ •์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

1. Installing

๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด์— ๋‹ค์Œ OpenCV๋ฅผ ์„ค์น˜ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.
๋จผ์ € ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด์— ์„ค์น˜๋œ ๊ธฐ๋ณธ ํŒจํ‚ค์ง€๋“ค์„ ์—…๋ฐ์ดํŠธ ํ•ฉ๋‹ˆ๋‹ค.

sudo apt-get update   
sudo apt-get upgrade  

์•„๋ž˜ ๋ชฉ๋ก์€ OpenCV๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ ์š”๊ตฌ๋˜๋Š” ํŒจํ‚ค์ง€ ์ž…๋‹ˆ๋‹ค.

build-essential
cmake
pkg-config
libjpeg-dev
libtiff5-dev
libjasper-dev
libpng12-dev
libavcodec-dev
libavformat-dev
libswscale-dev
libv4l-dev
libxvidcore-dev
libx264-dev
libgtk2.0-dev
libatlas-base-dev
gfortran
python2.7-dev
python3-dev

sudo apt-get install {ํŒจํ‚ค์ง€๋ช…}์œผ๋กœ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

์ด์ œ OpenCV๋ฅผ ๋‹ค์šด๋ฐ›๊ณ  ์•Œ์ง‘์„ ํ•ด์ œํ•ฉ๋‹ˆ๋‹ค.

wget -O openCV2.4.9.zip http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv 2.4.9.zip/download
unzip openCV-2.4.9.zip  

๋งŒ์•ฝ unzipํŒจํ‚ค์ง€๊ฐ€ ์—†๋‹ค๋ฉด sudo apt-get install unzip ๋ฅผ ํ†ตํ•ด ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.


์ด์ œ ์••์ถ•์„ ํ•ด์ œํ•œ ํด๋”๋กœ ๋“ค์–ด๊ฐ€์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ณผ์ •์„ ๊ฑฐ์นฉ๋‹ˆ๋‹ค.

cd openCV-2.4.9
cmake .
make -j4

cmake๊ฐ€ ์‹œ์Šคํ…œ์— ์„ค์น˜๋œ ํŒจํ‚ค์ง€๋“ค์„ ํ™•์ธํ•˜์—ฌ ๋นŒ๋“œ๋ฅผ ์œ„ํ•œ Makefile์„ ์ž๋™์œผ๋กœ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
๊ทธ๋‹ค์Œ make -j4๋ฅผ ํ†ตํ•ด์„œ ๋นŒ๋“œ๋ฅผ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.
๋ณดํ†ต oepncv ๋นŒ๋“œ์‹œ๊ฐ„์€ ๋งค์šฐ ์˜ค๋ž˜ ๊ฑธ๋ฆฝ๋‹ˆ๋‹ค. ๋นŒ๋“œ๊ฐ€ ๋งˆ๋ฌด๋ฆฌ๋˜๋ฉด ์ด์ œ ์„ค์น˜๋ฅผ ํ•˜๋ฉด opencv์˜ ์„ค์น˜๊ฐ€ ๋๋‚ฉ๋‹ˆ๋‹ค.

sudo make install

์„ค์น˜๊ฐ€ ์™„๋ฃŒ๋˜๋ฉด ๋ฒ„์ „ํ™•์ธ์„ ์œ„ํ•ด์„œ pkg-config --modversion opencv ์„ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

motion detection

์ด ์ฝ”๋“œ๋Š” ํ˜„์žฌ ๊นƒํ—ˆ๋ธŒ์— ์˜ฌ๋ ค๋†จ์Šต๋‹ˆ๋‹ค.

  • Github. ํ•˜์ดํผ๋งํฌ๋ฅผ ํด๋ฆญํ•˜์‹œ๋ฉด ๊นƒํ—ˆ๋ธŒ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

ํŒŒ์ด์ฌ์—์„œ doorwatcher.py๋ฅผ ์‹คํ–‰์‹œํ‚ค๋ฉด ์นด๋ฉ”๋ผ๊ฐ€ ์ฒ˜์Œ ์ฐ์€ ํ™”๋ฉด์„ ๊ธฐ์ค€์œผ๋กœ ์žก์Šต๋‹ˆ๋‹ค. ํ™”๋ฉด์—์„œ ์ด๋ฏธ์ง€ ํ”„๋ ˆ์ž„์ด ๋ณ€๊ฒฝ๋˜๊ฒŒ ๋˜๋ฉด ์ž์ฒด์ ์œผ๋กœ ์นด์šดํŠธ๋ฅผ ์„ธ๊ธฐ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค (์ตœ๋Œ€ 100๊นŒ์ง€ ์นด์šดํŠธํ•˜๊ฒŒ ์„ค์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.) ํ™”๋ฉด์—์„œ ์›€์ง์ž„์ด ์—†์–ด์ง€๋ฉด ์นด์šดํŠธ๋ฅผ ์ดˆ๊ธฐํ™”ํ•ฉ๋‹ˆ๋‹ค.

Videos

๋‹ค์Œ์˜์ƒ์€ ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด ์นด๋ฉ”๋ผ ๋ชจ๋“ˆ์ด ์•„๋‹Œ ๋…ธํŠธ๋ถ ์นด๋ฉ”๋ผ๋ฅผ ์ด์šฉํ•ด์„œ ๋™์ž‘ํ•˜๋Š” ์˜์ƒ์ž…๋‹ˆ๋‹ค.

Youtube

IMAGE ALT TEXT

โš ๏ธ **GitHub.com Fallback** โš ๏ธ