Dahua 4MP 25mm LPR Modification

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,329
Reaction score
5,325
Location
Denver, CO
Starting a thread for this project and discussion.. this is the poor mans long range LPR setup.

Camera: IPC-HFW4431M-AS-I2 ($100)
Lens: 25mm Cheap-o ($20 DHL)

Just installed the lens and am evaluating it, with this camera I was able to fully reassemble the camera despite the longer lens.. Taking the old lens off is a chore due to some epoxy holding the focus in place.. gotta chip away it it slowly with an xacto knife and then take it off w/some pliers.

This was a cheap plastic Chinese market dahua bullet with a weak SOC, it sucked as a general purpose camera; however it should work quite well for a dedicated LPR camera but I need more zoom to accomplish this w/ALPRD.

Here is my test picture from focusing it from the sofa out the back door, the target is ~95-100ft away according to google maps, this is cropped and not blown up in any way:

Galileo NVR-NorthALPR-2017-01-23-12-59-32.jpg
 
Last edited:

Dodutils

Pulling my weight
Joined
Dec 10, 2016
Messages
451
Reaction score
166
Hey I was about to do the same with a few lens I just ordered but as the thread of the M12 mount of the camera is too short I also ordered some thread extender :) and if anymone also want to test such modification, always check the MP rate of the lens the higher the better whenever it's higher than your MP camera's ensor !

upload_2017-1-23_21-24-3.png

Will also try with a 50mm M12 lens
upload_2017-1-23_21-30-55.png

and will also test M12 to CS adaptor as there are more choice with CS lens, less vignetting, and may be less chromatic aberration, but of course this will not feet inside camer'as box but I can do my own if needed.

upload_2017-1-23_21-33-16.png
 

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,329
Reaction score
5,325
Location
Denver, CO
Step 1. Remove screws on bottom protective faceplate, use a piece of tape to pry away.. the top is held on with foam tape, just tear it off and you'll get this:
IMAG0751.jpg

Step 2: Remove 4 screws on face plate, take it off and carefully gut the camera..
IMAG0750.jpg

Step 3: Remove the 3 wire plugs carefully by prying on plugs with your finger/screwdriver.. dont yank on wires.
Step 4. Remove screws holding boards down and carefully remove them.
IMAG0749.jpg

Step 4: Chip away at epoxy until you can remove the old lens w/pliers w/out damage
Step 5: Install new lens
Step 6: Reconnect wiring harnesses and make a prop out of cardboard/paper to hold up cctv board
Step 7: Power up camera, connect to web-ui and rotate image if needed.
Step 8: Manually focus it on a target at approx distance your trying to shoot for
Step 9: Unplug camera and put it all back together in reverse being carefull not to mess with the lens
 

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,329
Reaction score
5,325
Location
Denver, CO
@Dodutils yeah im not really giving a crap about image quality as long as pates are legible the goal has been accomplished.. Ive got better quality cameras watching the same view and since LPR requires a dedicated camera cause they are blind at night there is little reason to put any high grade optics on these imho.. at least not for LPR use.

the 25mm lens barely fit, I kinda had to synch it down but the screws still reached.. if you were going larger than that you'd need to add standoffs or longer screws to kick he CCD board back.. there's plenty of room in the housing though, its largely empty.. Would be trivial but require a bit of extra engineering.

Might have to run the camera in B&W all the time w/IR cut filter open so the focal points dont change, going to have to play with it.. 12mm dont seem to need refocusing, but 25mm I think will.. trying to combat that with a larger focal range via a smaller aperture, but going to need more IR at night I think.
 
Last edited:

Dodutils

Pulling my weight
Joined
Dec 10, 2016
Messages
451
Reaction score
166
I will not try this on a $100 camera but for now on one my ESCAM QD900 ($45 discount) and also one of my RaspiCam module #nofear ;-)

The reason I want higher quality it to record some wild life but I will not spend too much $$$
 

Fastb

Known around here
Joined
Feb 9, 2016
Messages
1,342
Reaction score
934
Location
Seattle, Wa
nayr:

Great tutorial. I may do that - I have the same cam. Using it to grab LP.

Some suggested additions, to benefit the wide audience:

Step 8A: When focusing, use a suitable target that has fine details. This helps you focus to get the clearest image. Sometimes zooming in (magnifying the image) can help get the sharpest non-magnified image. Use a big, clear monitor (NOT your cellphone!)

Step 8B: Replace the epoxy that held the lens in place, which prevented the lens from rotating and losing focus. Use something less aggresive, like hot glue.

(I had to free up a stuck IR Cut Filter once, and if memory serves, when I was inside, I was surprised the lens wasn't locked in position with a setscrew, or clamping the female threaded collar onto the lens).

Respectully Submitted,
Fastb
 
Last edited:

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,329
Reaction score
5,325
Location
Denver, CO
dont use epoxy or else you'll find your self back in the same boat trying to chip it all off to make an adjustment..

a dab of low temp hot glue works just as well and is much easier to remove.. besides, your not shipping it across the pacific so i dont think its even needed.
 

Fastb

Known around here
Joined
Feb 9, 2016
Messages
1,342
Reaction score
934
Location
Seattle, Wa
nayr,

I worked on HD IP cams that would be mounted on buses and trains. So I'm probably over-sensitive.
Maybe thermal cycling could cause the lens to rotate. But unlikely.
There were a lot of threads engaged, and twisting the lens had some resistance.

Fastb
 

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,329
Reaction score
5,325
Location
Denver, CO
ok if ur putting this on a train use epoxy, but be damn sure u got the thing focused right first heh.. I had cameras on trains once, they had extremely high failure rates and the employees werent too fond being watched either so the'd accidentally knock things against em.

its snug enough with ample threads, at least for me.. and its pinched between the mount and glass, really doubt any fixing is needed.

here's actual size comparison from 12mm vs 25mm @ ~80ft
Galileo NVR----2017-01-23-14-08-44.jpg Galileo NVR-NorthALPR-2017-01-23-14-06-44.jpg
 
Last edited:

bug99

Pulling my weight
Joined
Dec 27, 2016
Messages
397
Reaction score
154
1. being pretty naive on the whole optics topic (but wanting to figure it out), how would the image look in a long pinhole lens appear (assuming it would fit, which i doubt) in a camera like this? example lens. I would think being a pinhole that the F stop would be large, not 1.6 which is a large opening, right? so much to learn.

2. M12 seems to be a common mount. In general, why don't manufactures sell replaceable lenses for their fixed lens cameras? They seem to offer them in the various lens sizes (sometimes the longer ones are many times as expensive unassumingly due to low demand/supply).
 

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,329
Reaction score
5,325
Location
Denver, CO
that's for a 1" image sensor which this is not (its 1/3rd) it wont have the same ratings on a small sensor like this.

because this voids all warranties and they set focus and glue the lens down, so removing it is no simple task for the faint of heart... also once you get past 12mm you start to have the need to focus on site.. 12mm and under can infinite focus from up close to far away with a large depth of field.. as you start going up that depth goes down and things far away and up close start getting blurry.. so you wont find a fixed 25mm camera because it would require manual focusing, and you might as well have a motorized zoom for most uses at this point.

If your needing more than what this 25mm can accomplish perhaps you should consider just getting a CS mount box camera.. I got one of those doing LPR duty and i paid ~$150 for that w/out lens and enclosure.. you'll get auto-back focus and you can change the focus slightly to adjust for IR correction day/night.
 
Last edited:

Fastb

Known around here
Joined
Feb 9, 2016
Messages
1,342
Reaction score
934
Location
Seattle, Wa
bug99,
Manufacturers do sell lenses separately to fit their cameras. Axis may do the best job of that. They state which cam model is supported by various lenses (wide variety) they sell separately.
I bought these kits in the past: 1/3" Format
Varifocal, the manual way. Almost, since not truly variable.
s
I once made an HD IP cam from the housing of an analog cam. Used in the cab of a locomotive, it was a dual cam and aimed down the track. The long distance lens captured video of the things down-track. Where the crossing gates down? Lights flashing? Exactly when did the car drive around the gates (countering claims the gates WEREN'T down)
The wide angle lens captured what's to the left, center, and right side of the locomotive.
Two cams in one housing.

nayr, these cams didn't get abused or sabotaged by the train's engineers. The cam was their friend. The video footage would show the engineer wasn't at fault....

Our cams on buses, however, were subject to abuse/vandalism. Inside a city bus, the cams had overlap. Vandalism to camera A was usually caught by camera B and C. Or the covert cam behind the sign that said "Watch your step on the stairs"

Unions often negotiate rules that prohibit the camera from recording the actions of train engineers or bus drivers... They felt mgmt would watch them (spy). Mistrust was root cause....

Fastb
 

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,329
Reaction score
5,325
Location
Denver, CO
note this camera in MJPEG is limited:
2304x1296 = 12 FPS
1560x1440 = 10 FPS
2592x1520 = 9 FPS

I'll be running this at 2304x1296 I suppose.. gonna mask off large portions of the image and only scan for plates within a certain area anyhow.. I dont record my LPR cameras because alprd has been reliable enough at capturing plates its not needed.

dont really need high FPS on residential streets.. ive seen 5-6fps being adequate for the job.. but the higher the FPS the smaller you can mask em off and the less overall load
 

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,329
Reaction score
5,325
Location
Denver, CO
so everything's out of focus w/IR flared up, think I'll focus this for best performance at night and if its slightly fuzzy in the day it'll be easier to read.
Galileo NVR-NorthALPR-2017-01-23-17-36-20.jpg
still its legible but this would be pushing alprd to get success.


this is with built in IR, not with an external IR cannon.. gain would go down if I had more IR.
 

Fastb

Known around here
Joined
Feb 9, 2016
Messages
1,342
Reaction score
934
Location
Seattle, Wa
nayr,

Focusing for optimal performance in the "tough" environment is pb'bly wise.
The "easier" environment (daytime) should still get good images.

Focusing w/ the IR Cut Filter removed from the optical path my help greatly.

Fastb
 

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,329
Reaction score
5,325
Location
Denver, CO
well this fucking sucks, the MJPEG stream coming out at any resolution higher than 1080p is totally fucked.. Tried @cor35vet newest firmware and mjpeg was removed entirely.. sigh.

Screenshot 2017-01-23 22.09.07.png

These China Region Dahua's f'n suck.. so if I want to use this for LPR then its gonna be 1080p and thats gonna reduce distance
 

hmjgriffon

Known around here
Joined
Mar 30, 2014
Messages
3,401
Reaction score
980
Location
North Florida
Let us re remind Andy to never send any of us a Chinese region camera lol

Sent from my Nexus 6P using Tapatalk
 

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,329
Reaction score
5,325
Location
Denver, CO
so I guess if your not planning on using alprd then this will still be quite suitable, since this is actually a backup camera I'll just live with recording the stream on motion and doing a visual confirmation if nessicary.. at least until I am ready to dedicate more time/money into this backup LPR.. Was thinking if it at least detects plates reliably enough I could have a 720p mjpeg substream trigger the main stream to an alarm event when there's traffic.. then the timeline for this camera would be flagged with plate detections at least.. wouldent be a bad idea for the other LPR camera too.

focused it on the plates at night, helped alot:
Galileo NVR-NorthALPR-2017-01-23-23-43-07.jpg



Before:
Code:
plate1: 10 results
    - XJB657     confidence: 82.6297
    - XJB857     confidence: 81.7377
    - XJBB57     confidence: 77.7769
    - XJB6S7     confidence: 73.8876
    - XJB8S7     confidence: 72.9956
    - XJB65T     confidence: 70.4636
    - XJB85T     confidence: 69.5716
    - XJBBS7     confidence: 69.0349
    - XJ8657     confidence: 66.0557
    - XJBB5T     confidence: 65.6109
After:
Code:
plate0: 10 results
    - XJB857     confidence: 89.1725
    - XJ8857     confidence: 79.1371
    - XJB8S7     confidence: 77.8991
    - XJBB57     confidence: 77.2389
    - XJBG57     confidence: 74.3983
    - XJBQ57     confidence: 74.2072
    - XJG857     confidence: 72.6084
    - XJ88S7     confidence: 67.8637
    - XJ8B57     confidence: 67.2035
    - XJBBS7     confidence: 65.9655
Settings used:
  • Sharpness = 45
  • Shutter = 1/500
  • Gain = 50
  • Backlight = Off

edit: the 720p substream is actually pretty damn good, might be usable afterall:
Galileo NVR-NorthALPR-2017-01-24-00-11-59.jpg
 
Last edited:

ldasilva

Pulling my weight
Joined
Mar 20, 2016
Messages
449
Reaction score
247
that looks pretty good without any extra ir
now the ? is head lights added
 

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,329
Reaction score
5,325
Location
Denver, CO
headlights wont matter, im already running a 4MP Dahua LPR Camera at these settings.. it works :)

thinking of installing this behind the fence with a couple of carefully placed holes for IR/Lens looking at the intersection.. gotta few ideas.. either way its a dead end street so this camera should get both ends of any vehicle

Its got pretty damn good IR on it, dunno if its because I modified a 12mm but its fairly narrow and not that wide of a IR beam coming out.. here's the view from the Starlight w/its IR disabled:
Galileo NVR-Dahua Starlight IPC-HDW5231R-Z-2017-01-24-01-25-44.jpg
I doubt a wide angle bullet would have had an IR patten such as that, probably best to modify a 12mm so you get a more focused IR pattern for longer range.

As for the 4MP Varifocal Bullet @ 12mm, were well beyond all usability at these distances
Galileo NVR----2017-01-24-01-30-34.jpg
 
Last edited:
Top