Showing posts with label camera. Show all posts
Showing posts with label camera. Show all posts

Saturday, February 6, 2016

Turning a Dash Cam into a Surveillance Camera

I've had to come up with a solution to a strange problem.  A relative thinks that someone is stealing their pot plants at night.  To see what's really going on a surveillance camera would be great.  The main problem is that most of the options on the market are just cameras that send an image back to central location for monitoring or recording.  This can be via a wireless connection or physical cables.  I don't want that, I want something really simple.  There's no internet connection or wireless network at this place, so that rules out a lot of options.  I can already hear people saying things like, Raspberry Pi, zone minder, WiFi dongle, IP camera, webcam.  Totally agree, if I was living there and had time to tinker, that's probably what I'd do, but this isn't one of those projects I'm doing because I love it, it just needs to get done.  Besides, I can see what would happen.  Project goal is to install a surveillance camera, spend a week in Linux trying to figure out why the webcam drivers don't work, or tracking down that the Raspberry Pi is restarting because the power cable isn't thick enough for the current it needs.  Screw that.

There is a far easier solution though, and luckily I had all the parts.  Take a car dash cam and power it from mains electricity though a timer.  Boom, done.  Well, not quite.

dash cam
Dash cam running on mains power
My father happened to have a spare dash cam he bought cheaply at ALDI.  It's not state of the art, but image quality is good, and it has some nifty features that will come in handy.  The display isn't of much use, but for aligning the camera it will be useful.

The plan is to have the timer come on at 6 pm and go off at 6 am.  This will active the camera in exactly the same way as turning on a car ignition.  Recordings that long will take up a lot of disk space, but luckily this model has a option to only record when movement is detected.  So most of the night the camera won't be recording anything.  If in the morning the relative suspects something has happened during the night, all they need to do is turn off the power to the camera.  I'll then inspect the footage when I'm available.

dash cam
Flip down display
The camera has 6 IR LEDs on the front that come on when it gets dark.  They seem to be rather good LEDs that don't bleed into the visible spectrum.  I can't imagine that they'll do much to illuminate a yard, but, we'll soon find out.

dash cam
IR LEDs
The original plan was to use a USB wall wart  from a phone to power everything, but as it turns out, the USB port is for charging and transferring data to a computer.  When a cable is plugged in the camera won't turn on.

dash cam
USB Port
To solve this I used a variable switch-mode power supply I had.  After testing the polarity and voltage of the power supply the camera came with, I replicated that with variable supply.  When connected to the camera with the appropriate plug everything worked fine.  Turn on mains power, and the camera enters standby mode read to capture any motion.

dash cam
Power Port
The timer doesn't really warrant a mention.  It's a simple mechanical timer that if needed my relatives are capable of setting.

The camera is now installed and waiting.  Let's see if we can catch this horticultural hijacker, blossom bandit, perennial prowler, seedlings stealer, leaf larcenist.  Sorry, couldn't help myself. :-)

Monday, August 3, 2015

8MP Aliexpress ELP Webcam

I've recently been thinking about using the Raspberry Pi for image processing and wanted to use a Logitech C525 web cam that I'd bought earlier in the year.  It quickly became apparent that its resolution was less than expected and although it'd probably be fine, I didn't want the image quality to be the limiting factor of my project.  The next step was to start looking around for cheap web cams on my favourite Chinese sites.

I wanted a reasonable image quality and resolution for a decent price, and luckily enough it turns out that this isn't too hard to find.  A store on AliExpress called Ailipu Technology was selling an ELPCCTV brand 8 MP USB web cam for approximately 85 AUD.  I'll get into the specs later on, but first I want to look at the construction as it differs from a standard retail web cam.

WebCam
ELP-USB8MP02G-L75
The camera is a cubic shape made of an extruded 40 mm aluminium profile with metallic front and back plates.  The camera is mounted to the front plate with a manually adjustable lens protruding out approximately 10mm.

WebCam
Back of Web Cam
The USB cable is removable and is connected with a 4 pin locking connector on the back plate.  I assume this allows easier installation if it's used as a security camera.  Most of the products the company sell are marketed to the security industry.

Connector
Web Cam Connector
At the bottom of the connector in the image above you can just see a small metal ball that's used as part of the locking mechanism.

Connector
Web Cam Connector
The outer part of the connector in the image above is a retractable shell that locks the plug in place when it's inserted.

So now for the specs.  The camera has a claimed resolution of 3264 x 2448 and uses a Sony IMX179 sensor.  It turns out that this seems to be the same sensor used in the Nexus 5 phone from 2013.  The business model that the company appears to use is it to take old excess phone image sensors (could possibly be a lower grade) and re purpose them as web cams.  The sales page claims 15 frames per second at maximum resolution but that seems a little far fetched.  I've only been able to get 2 fps which seems more realistic for a USB limited connection.

Before using the camera I wanted to be certain that the stated resolution was real and not some made up interpolated number.  In the past I've seen webcams that market themselves at the interpolated resolution which in my opinion is a blatant lie.  To do this I found an ISO12233 test chart from Cornell University and used it to verify the cameras specifications.

The process is simple, take some photos of a high quality printed version of the chart, and then analyse the image to observe the resolution limits.  I went to the local office supply store and had an A1 version of the test chart printed for a couple of dollars and then glued it to 600 x 900 mm Masonite panel that had been painted black.

Test Pattern
ISO 12233 Test Chart
As you can see from my test apparatus below, this wasn't going to be a very scientific test.  The test pattern isn't completely perpendicular to the camera, but by doing the test outside I got as much light as possible on the board to take a good image.  For my analysis I'm only testing the vertical resolution just to double check the claims the manufacturer made.

Calibration Setup
Test Set-up
First up is the 8 MP ELP camera with a 3264 x 2448 sized image.

Test Pattern
ELP Camera Test Image
The lines on the vertical resolution test marker start to merge at about the 1400 lines per picture height mark.  As the picture in the image is 1750 pixels high, this mean that the image is a total of  1400*(2448/1750) = 1958 lines high.  This may seem small but it's 80 percent of the stated vertical resolution, and when you consider the non ideal test arrangement, and my eyeballing of the resolution chart, I'm satisfied that the resolution claims are correct.

Test Pattern
ELP Camera Resolution Limit
While I was at it I thought I'd test some other web cams.  First up is the Logitech C525 Auto focus camera.
WebCam
Logitech C525 Web Cam
The test shot is at its maximum resolution of 1392 x 768.

Test Pattern
Logitech C525 Camera Test Image
In this case the markers merge at the 650 lines per picture mark.  As the picture is 600 pixels high this means that there should be 650 * (768/600) = 832 lines in the image.  Once again this is 8 percent higher than the stated resolution and when you take into account the errors in the measurement method, I'm happy that the stated resolution is correct.

Test Pattern
Logitech C525 Camera Resolution Limit
Finally, let's test my old C120 camera.

WebCam
Logitech C120 Web Cam
It produces and image with a resolution of 640 x 480.

Test Pattern
Logitech C120 Test Image
You're going to have to take my word for it, but the test markers merge at about the 350 vertical lines per image mark.  As the picture is 347 pixels high, the total image has a resolution of 350*(480/347) = 484 lines, which agrees with the specified resolution.

Test Pattern
Logitech C120 Camera Resolution Limit
In the end I'm verry happy with the camera it a good resolution and image quality for the price.