The source code for this app is available here.
The alpha version is available in Google Play.
It is year 2014. Happy New Year to everyone!
For the last couple of months I have been developing an Android app which I initially targeted to complete by end of year 2013. Nonetheless, the progress is rather slow since I am working on it part-timely due to other commitments and the schedule has been delayed a few times.
Besides time constraint, there are also technical challenges as well. The app I intended to develop should have the following features
- Able to use phone camera for surveillance purpose within Intranet.
- Able to access phone camera for surveillance purpose, accessible from Internet easily without the hassles of complicated setup.
- Able to plug in any webcams or spy cameras into your notebook or PC, and access and view them from another machine or from your mobile phone.
- Provide features like motion detection, automatic email and SMS alerts upon motion detection, and save detected motion pictures into cloud storage.
- Turn your mobile phone into a SMS gateway, exposing the functions through REST APIs. This will be integrated into my other projects and products here and here.
There are no break-through ideas here but this is definitely helping me to keep up with the technologies. On top of that, releasing the code as open source is also one way to contribute to the community.
Let’s start with the 1st features to leverage your phone for surveillance purpose.
To start with, I used the following to design the UI
- SlidingMenu for the left sliding menu. (Note: Alternatively the built-in Android Navigation Drawer can be used for this purpose)
Below are some of the screenshots for the app.
To be able to access your phone and phone camera remotely you need to have a web server running in your Android phone, serving content over HTTP. Below are the components or libraries that I used for this purpose.
- NanoHTTPD – Chosen as it is lightweight and easily customizable.
- AngularJS – This is chosen as I wanted to learn this framework.
- ngBoilerplate – To get started faster on AngularJS.
- Gson – JSON library for exchanging information between server and client.
- Android Async Http Client
For this app, I have a control panel service running to host an AngularJS app which serves as the main entry point to the phone. You can start/stop the service through the Control Panel function and change the listening port.
Once the service is started, you can access the provided URL through any web browsers.
Some of the screenshots are shown below.
Motion and Face Detection
For motion and face detection, I use OpenCV4Android. You can control this from the Settings menu. The followings are supported at this moment
- Enable/disable motion and face detection
- Configure motion detection threshold
- Different motion detection algorithms – Simple, Background Subtraction or Motion History Image (MHI)
- Configure the contour thickness
Once enabled, you can choose to view the detected motions or faces from the web browser by enabling or disabling “Stream detected motion and face”.
What You Can Do Now with This App
As I mentioned in the beginning of this post, development of this app is still very much in progress. What you can test or use are the following features
- Configure HTTP listening port
- Start/stop the service
- Auo start the service upon reboot
- Start the camera in surveillance mode
- Change to front/back camera and its resolutions by using the left sliding menu in camera mode
- Configure motion and face detection settings as described above.
Remote Viewing (Intranet)
- Remotely start the camera in surveillance mode (Control Panel service must be started)
- View the streamed video and audio, change the canvas and resolution size.
- For remote viewing, motion JPEG is supported. Please note that only Chrome and Firefox support MJPEG. For Internet Explorer, use the frame update option. The web application should detect this automatically for you.
- You can also use VLC media player to open the URL to MJEG and view the streamed video.
In my next series of posts I am going to talk in more details on the lessons learnt, technologies used and challenges that I faced while developing this application. By the end of this series, hopefully I am able to roll out this application successfully