Intro
This is my research project based on the Image Processing technique that I learned from the Wheelchair Project, web and Android development. The observation system uses a camera to detect human movements and light changes in our office. If an event happens, the system will capture the motion series and store them into the file system and database as evidents. User with permission can retrieve the evidents including captured pictures and the evident details.

Design
In this project, I used Robot OS as the framework for video streaming from the camera to the third party applications. ROS supports nicely video streaming using video_stream_opencv package. I created the Monitor App to subscribe to the video stream topics in ROS system, this app uses Java AWT and the Image Processing uses OpenCV to process every single frame to detect motions.

Image Process
The image process comprises:

  • Step 1: turning the image into grayscale
  • Step 2: subtracting two consecutive images to find the differences
  • Step 3: detect and draw the boundaries of all the contours of the difference areas
This process is performed on every frame. When the contours are found, the frame is contour-marked and denoted as evident for an occurring event. The frames will be saved to the File System and the according event records are stored into the database (MongoDB).

REST APIs
For the accessibility of mobile and web apps to the File Server and events in the database, I designed a REST Service hosted on Tomcat server, this web service provides basic functionality for listing and deleting events, as well as retrieving evident imageries. I also developed a Video Streaming topic to enable video streaming to the web and mobile apps. The video stream is available in the form of URL so that developer can easily embed in an IMG tag.

Front-end Apps
Regarding web front-end, it is built using JQuery to implement interactive interface. I also created a simple Android app using ROS For Android library. This library allows me to connect to the central ROS system for video streaming on Android. To call REST APIs, I used OkHttp library.

Source code for the Android can be found on my Github page.