© 2018 marearts.com All rights reserved  

Never Miss a Post. Subscribe Now!
Mar 17

Chapter 7. Project #1 Intrusion Detection


Edited: May 7


Youtube :

https://youtu.be/IUrZGsw9Hb8 (1/5) : Background Subtraction

https://youtu.be/AOvnl08kspw (2/5) : Noise remove, Decision moving area

https://youtu.be/mqJZIAwxfUE (3/5) : Morphology

https://youtu.be/vRKIrhtnSrg (4/5) : Moving Average for update BG image

https://youtu.be/hPeZM_6oly0 (5/5) : Multi thread, upload image to google drive


1. Moving Object Dtection

Simple Background Subtraction code : http://study.marearts.com/2017/02/cvlecture-example-code-video-subtraction.html


2. Background Subtraction -> remove noise -> Binarization

source code : http://study.marearts.com/2019/04/opencv-simple-background-subtraction.html


3. Find Contour -> Draw Rectangle & save image

:Refer to here for find contour :

Youtube: https://www.youtube.com/watch?v=-qE-evo_QvI

Material : https://www.cvlecture.marearts.com/forum/opencv-lecture/chapter-3-drawing-mouse-and-control


4. Morphology

Source code : http://study.marearts.com/2013/08/opencv-morphologyex-getstructuringeleme.html




5. Moving Average

soruce code: http://study.marearts.com/2019/04/moving-average-background-subtraction.html



6. Upload image to google drive

Description: https://www.cvlecture.marearts.com/forum/computer-vision-forum/upload-file-to-google-drive-using-python

Youtube: https://youtu.be/ZL_9gqxAdok

pyInstaller : https://www.pyinstaller.org



7. Multi Thread




Thank you.







New Posts
  • Video Youtube : https://youtu.be/3BYyKDJId0w https://youtu.be/mSfkdCEwk1s cvlecture : Install Python & OpenCV (1/2) Install IDE and test OpenCV (2/2) 1. Install Python Window & Mac Download Python installer file :  https://www.python.org/downloads/release/python-373/ download python installer run installer and check Path Make sure where python will be installed check python version pip upgrade >pip install --upgrade pip Refer to other person tutorial :  https://www.ics.uci.edu/~pattis/common/handouts/pythoneclipsejava/python.html 2. Install Python OpenCV opencv-python installation >pip install opencv-contrib-python check OpenCV version 3. Install IDE Download Visual Studio Code https://code.visualstudio.com/Download install run VS code -> Set python interpreter -> run simple code Find python in "extensions:marketplace" and install type in command window "python: select interpreter" select python execute which we have installed before run code 4. Test OpenCV Simple OpenCV Code : https://gist.github.com/MareArts/9034e7e638a30551d9ef370c4a364618 import numpy as np import cv2 cap = cv2.VideoCapture(0) ret, frame = cap.read() while(True): # Capture frame-by-frame ret, frame = cap.read() # Our operations on the frame come here gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) # Display the resulting frame cv2.imshow('frame',gray) if cv2.waitKey(1) & 0xFF == ord('q'): break # When everything done, release the capture cap.release() cv2.destroyAllWindows() Thank you! ☕️
  • Video Youtube : https://youtu.be/9T0c6gvHiwg (1/2) https://youtu.be/J5TUipRipj4 (2/2) CV Lecture Video (1/2) Video (2/2) Preparation : Download Visual studio IDE : https://visualstudio.microsoft.com/downloads/ Download OpenCV Library : https://opencv.org/releases.html Window Environment Setting: Window bin file path setting Advanced system settings -> Environment Variables -> Edit System variables -> add opencv bin path Add new path variable Advanced system settings -> Environment Variables -> Add new opencv path in User variables for user VS studio setting: select x64 mode project -> properties VC++ Directories -> Include Directories Add $(OPENCV_LIB)include VC++ Directories -> Library Directories Add $(OPENCV_LIB)x64\cv15\lib CODE test #include <iostream> #include <opencv2/opencv.hpp> #ifdef _DEBUG #pragma comment(lib, "opencv_world401d.lib") #else #pragma comment(lib, "opencv_world401.lib") #endif using namespace cv; using namespace std; int main() { VideoCapture stream1(0); //0 is the id of video device.0 if you have only one camera if (!stream1.isOpened()) { //check if video device has been initialised cout << "cannot open camera"; } namedWindow("Processing"); namedWindow("Origin"); //unconditional loop while (true) { Mat cameraFrame; stream1.read(cameraFrame); //get one frame form video imshow("Origin", cameraFrame); Sobel(cameraFrame, cameraFrame, CV_8U, 1, 0); //sobel processing imshow("Processing", cameraFrame); if (waitKey(30) >= 0) break; } destroyAllWindows(); return 0; } Thank you!
  • 0. video information 6-1) https://youtu.be/xrVNc1Svkx4 6-2) https://youtu.be/j9bkYpUdv5g 6-3) https://youtu.be/nYjl27rwl50 6-4) https://youtu.be/ELbNXVjpBAQ 6-5) https://youtu.be/k_oYacxDb4c 6-6) https://youtu.be/K2TpZI2lPdc 1. Histogram introduction source code http://study.marearts.com/2013/09/opencv-make-histogram-and-draw-example.html http://study.marearts.com/2014/11/opencv-emdearth-mover-distance-example.html http://study.marearts.com/2014/05/open-cv-get-histogram-and-compare-color.html #bin, #hog, #bow 2. Histogram make & draw Source code C++ histogram : http://study.marearts.com/2017/12/gray-image-histogram-without-opencv.html OpenCV histogram OpenCV Histogram : http://study.marearts.com/2017/12/calhist-for-gray-image-opencv-histogram.html Histogram draw : http://study.marearts.com/2013/09/opencv-make-histogram-and-draw-example.html RGB Histogram : http://study.marearts.com/2017/12/calchist-for-rgb-image-opencv-histogram.html Reference https://docs.opencv.org/2.4/modules/imgproc/doc/histograms.html?highlight=calchist#histograms https://docs.opencv.org/2.4/doc/tutorials/imgproc/histograms/histogram_calculation/histogram_calculation.html #Calchist, #normalize, #grayhistogram, #rgbhistogram 3. Hue(hsv) histogram Source code Image : http://study.marearts.com/2017/12/hue-histogram-example-opencv-source-code.html Webcam version : http://study.marearts.com/2017/10/webcam-histogram-test-opencv.html Reference https://en.wikipedia.org/wiki/RGB_color_space https://en.wikipedia.org/wiki/HSL_and_HSV #cvConvert, #hsv, #hue, #saturation, #value, #hsi 4. 2D histogram source code http://study.marearts.com/2014/11/opencv-randn-example.html #minmaxLoc, #2dhistogram 5. Stretching source code http://study.marearts.com/2017/12/opencv-histogram-stretching-example.html #stretching, #normailize 6. Equalization Source code http://study.marearts.com/2018/01/histogram-equalization-stretching.html #equalizeHisto