Infrared focus shift - explanation

wopi82

IPCT Contributor
Joined
Feb 9, 2017
Messages
117
Reaction score
798
Location
Poland
While reading the forum's threads, I found some posts with complains about soft image while the camera is going from color to IR or the opposite. In this Testing roundup IPC-HDBW4431EP-AS versus IPC-HDBW5431E-Z thread, TVT73 is complaining about soft focus in IPC-HDBW4431EP-AS camera. Here Any Dahua cams WITHOUT the focus bug? Jeroen1000 is calling this a "focus bug".

In reality this is not a "bug" or any firmware/hardware error. It's just physics of electromagnetic waves, and every camera with removable IR filter, without advanced optics will experience this focus shift to some extent.

IR_lens_diagram-936x1024.jpg

When visible light passes through the camera's lens, the focus plane overlays precisely with image sensor, and so the image is sharp. The infrared light passing the same lens, focuses tiny bit further from the lens and thus the image becomes blurry. The final night image consist of a mixture of visible and infrared light. And so different objects on the image may look more or less out of focus, depending on how much IR light is being reflected from them. Below is an example from my HDW4231EM-AS camera.

IR_vs_color.jpg

The tree branches as well as bushes are noticeably blurry in night mode, but the inside of the car look almost identical between two modes.

Owners of fixed lens cameras have no chance to fix this, as there is no autofocus available. However varifocal cameras can refocus and correct this shift. It would be a pain in the butt to do that every twice a day, but it is possible. The best solution is to use ultra low dispersion lens, but these are expensive and would rise the overall cost of the camera.

Anyway, I thought it will be useful to share this info with you. For further reading go to:
Resolving the Problem of Focus Shift - CCTV Information
IR Corrected vs. Standard Lenses: Chromatic Aberration | OEMCameras.com Blog
 

Jeroen1000

Young grasshopper
Joined
Sep 26, 2016
Messages
42
Reaction score
13
I appreciate you taking the time explaining this in more detail. Kudo's! It is certainly useful.

However, a fix is pretty easy! When the camera switches from day to night or the other way around, you can make it go to a *stored* focus value. Do note the fact it goes to a stored value. It does not perform a full autofocus cycle. This operation takes about a second on my cams. So I do get you saying it is not a bug, but at least it is just sloppy programming:). I do consider it a firmware error because of that.
 

wopi82

IPCT Contributor
Joined
Feb 9, 2017
Messages
117
Reaction score
798
Location
Poland
Thank you Jeroen1000 for the info. I did't know there is such an option. My camera is only fixed lens. What do you mean by programming? Is it some kind of script? Can it be done by Dahua's own software? If not, than what software you use?
 

Jeroen1000

Young grasshopper
Joined
Sep 26, 2016
Messages
42
Reaction score
13
It is using the CGI-interface. I've attached the PDF for reference. You can thus send the camera the focus value using HTTP and it will change its focus to that value.
However, there is not an accurate enough trigger. The exact moment for D/N switching depends on the kind of day: cloudy, sunny, well you get the point. The best you can do is a fixed hour for camera's that are in the same lighting position all night.

Have a floodlight? Well too bad, you cannot react to a floodlight on off event using time programming. It is possible using sensors and triggers however, this is super easy to solve with firmware. I don't know why Dahua has not been doing this since...day 1. It's just a tiny amount of code tied to the code that makes the camera decide to switch to color or monochrome.

If they do not want to program this, they should use IR-corrected lenses but since the picture gets blurry I assume they are not using those. Can you focus your camera's using the GUI since they are fixed? Or does it require a ladder:)
 

Attachments

wopi82

IPCT Contributor
Joined
Feb 9, 2017
Messages
117
Reaction score
798
Location
Poland
A ladder :) In fact, there is no way to fix that in fixed-lens version. I have to live with that and get used to it. I was thinking about buying fixed lens IPC-HDW4631EM-ASE. Right now I have a dilemma between this one and varifocal IPC-HDW5631R-ZE. IPC-HDW4631EM-ASE is cheaper (I will not use zoom), due to IR/LENS separation there is no IR reflection in the glass. However, the higher the resolution, the more you see this focus shift. At 2 megapixels (fullHD) it is noticeable, but not so distracting. At 6 megapixels it will be annoying. And so, I am wondering between these two models, because varifocal has an autofocus and slightly brighter lens.
 

tangent

IPCT Contributor
Joined
May 12, 2016
Messages
4,342
Reaction score
3,524
In addition to varifocal cameras, fixed cameras with auto back focus (ABF) can adjust for this slight shift.
 

wopi82

IPCT Contributor
Joined
Feb 9, 2017
Messages
117
Reaction score
798
Location
Poland
True, but it is available mostly in box cameras, with interchangeable lenses.
 

wopi82

IPCT Contributor
Joined
Feb 9, 2017
Messages
117
Reaction score
798
Location
Poland
I thought it would be interesting to see a direct comparison of an object illuminated by IR light and visible light. I took my Xblitz Night dashcam with IR LEDs and a torch to see the difference. I wanted to use some well defined object so that the difference would be well seen.

IR-vs-visible.jpg

This is me, with some Christmas decoration :) These are 1:1 crops from a full view. The middle one is definitely more blurry than the right one. This means that if you have a scene, where part of it is illuminated by let say IR reflector and the rest is some artificial visible light, refocusing may not resolve the problem, because focusing to IR illuminated part will defocus the rest and vice versa. If the scene is fully illuminated by IR than no problem, but in case of mixed illumination, the best solution is UD lens.
 

TVT73

Pulling my weight
Joined
Aug 29, 2016
Messages
406
Reaction score
108
Location
Germany
It´s really frustrating, as I comment this issue since over half an year and for autofocus cams it´s really simple to be solved with a little firmware modification.

Unfortunately dahua´s engineer seems to give a dam on it, several tries through different selling channels has got no result in this. In fact a 2mp cam is much less affected than a 4mp or higher, and due to this I can´t recommend to buy those cams, if night view with IR is necessary.
Interestingly for fixed focus 4mp ones I can´t see the night focus issue. It has maybe to do with a different infinity focus point and the higher aperture.

I am hopeless, that a firmware fix will ever arrive. If you have a look on how dahua behaves on firmware issues, you all would know why I am thinking this. My issue list is growing and most of them are unsolved for ever. (Day/Night profileswitching by ambient light, nvr 4xxxx - 4ks2 and 5xxx - 4ks2 profile switching sheduler is lost, IVS tripwire fails when lines are too near the outer side of picture, manual shutter control is broken when using an nvr, for speaking of only the most burning ones for me ) And yes, I have documented them well, with step by step issue log and screencasts ...

For that there is no misunderstanding, Dahua is selling a good hardware for an affordable price, many main parts are working very well. But if you are running into an issue and hope to get an solution from dahua, you are lost :(
This is maybe a price tag reason. And the engineers has done (a good job) in fixing the last several upcoming security issues, so that there are no resources of man power left :rolleyes:

Here some of my conversations about it...

Dear Torsten,


Thank you very much for your information.



I have provided 3 ways(Both way1 and way2 are included) of solutions to our R&D team menbers yesterday. And I am waiting for the feedback from them which they will integrated.


I also suggest them apply it to all our cameras and PTZ. When i have clear schedule for the planing, I would like to let you at the first time.


Thank you again!

I am on business trip from 16 March to 15 April, and have limited access to my email,

I apologize that I am unable to respond to you immediately, but will do so as soon as possible.

If you require immediate assistance, kindly call me xxx

-----------------------------------------------------------------------------------------------------------------------------------------

Best wishes!

Liz Wei

Technical support D-A-CH



********************************************************
ZheJiang Dahua Vison Technology CO.,LTD.
ADD: A17, No.1199 Bin'an Road ,Binjiang District,Hangzhou,P.R.C
TEL : +xxx
Mobile: +xxx
Email: xxx@dahuatech.com
Skype: xxx

WeChat:xxx
Http://www.dahuatech.com
********************************************************


From: xxx [mailto:xxx]
Sent: Thursday, April 06, 2017 4:17 PM
To: wei_hanqin
Subject: AW: Focus issue on zoom lens cams


Dear Liz,

may i give you some thoughts and hints for 2 possible focus issue solutions:


Way 1:

This will be the quit and dirty solution. It works but it´s not preferable. Every time the cam switches from day to night view and the icr is activated the cam will do an auto focus.


This solution has a big disadvantage, auto focus is slow. It will last around 5-7s to do this. In setups with fast switching day/night sensivity it struggels always on refocusing. P.e. when using visible light triggered by external motion sensors.


Here is a better working way:

Way 2:

We need 2 variables in zoom & focus menu, daytimefocuspoint and nighttimefocuspoint. On camera bootup both variables are = 0, the startup sets the first focus depending of day or night startup with the first auto focus triggered from bootup.

Later on, when the camera the first time switches to day or night the program looks if day or nighttimefocuspoint is zero and if so a autofocus is released. The result is stored in the corresponding variable. At this time bot variables are filled with the correct focus point. On the next time the cam switches to the other profile, it will recognize that the variable is not zero. Because of the possibility to set a manual focus point the cam now uses the different focus point.


It’s really fast, less movement for the lens system and the user can define manual focus points, this is sometimes useful under special picture setups.


This should be a global solution for every zoom lens cam. We would all benefit from this.
and further more from technical support:
Dear Torsten


Do you mean new firmware with function as below. If yes, @Liz,please submit request to R&D and provide firmware once it is released.


  • Add new option, that customer can configurate and save the zoom & focus status of Day/Night according to real scene.

Mit freundlichen Grüßen / Best regards


Alex Xiang/项永辉


From: xxx

Date: 2017-05-09 18:37

To: Alex Xiang/项永辉

Subject: AW: AW: FW: Focus issue on zoom lens cams

Dear Alex,


I am setting up a customer installation with 3 peace’s of ipc-dxw5231r-z cams, do you have some news for the firmware?


Mit freundlichen Grüßen / Best regards

xxx



Von: Alex Xiang/项永辉 [mailto:xxx]
Gesendet: Montag, 24. April 2017 12:36
An: xxx <xxx>
Cc: wei_hanqin <xxx>
Betreff: Re: AW: FW: Focus issue on zoom lens cams


Dear Torsten


Many thanks for your fast feedback.


Actually, we are discussing this issue with IPC Product Manager internally whether we can fix all firmware for IPC with motorized lens and release firmware to dahuasecurity.com.


We will sync further info with you once we have result.


Bur for your urgent need, we can submit request to R&D and fix this issue for IPC-HFW2421R-ZS-IRE6.



Mit freundlichen Grüßen


Alex Xiang

Technical Manager D-A-CH
 

imog

n3wb
Joined
Dec 5, 2016
Messages
21
Reaction score
8
I appreciate you taking the time explaining this in more detail. Kudo's! It is certainly useful.

However, a fix is pretty easy! When the camera switches from day to night or the other way around, you can make it go to a *stored* focus value. Do note the fact it goes to a stored value. It does not perform a full autofocus cycle. This operation takes about a second on my cams. So I do get you saying it is not a bug, but at least it is just sloppy programming:). I do consider it a firmware error because of that.
Worth noting this focus value isn't available on some cameras, for example the PTZ sd49225t-hn. It's a big issue for switching daytime/nighttime, as the only focus adjustments are relative, which is really difficult to dial in vs an absolute setting.
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,666
Reaction score
14,006
Location
USA
The first IR camera I ever got (not Dahua) had it way, way worse than this. It was manual varifocal of one of those Chinese brands that is there one day and gone the next. Not only was it impossible to have it well-focused across the entire field of view at once, but it wasn't IR-corrected at all so you could focus it for visible light or IR but not both.

I still have the old screenshots:





Dahua cameras by comparison do very well, even with fixed focus lenses.
 

Jeroen1000

Young grasshopper
Joined
Sep 26, 2016
Messages
42
Reaction score
13

imog

n3wb
Joined
Dec 5, 2016
Messages
21
Reaction score
8
Dahua cameras by comparison do very well, even with fixed focus lenses.
I appreciate the perspective. That said, I am disatisfied that a $350 Dahua varifocal needs refocused for daylight/IR. Admittedly I'm not qualified to know what to expect, but both my hik ds-2cd2t42wd-i8 have no apparent focus issues with switching and cost less than half as much so I guess that was my baseline. This was probably foolish, as the use case is completely different - the Dahua sd49225t-hn doesn't have an issue if autofocus is enabled and the scene is reasonably lit. But configured to read license plates at 150ft at night it has a big issue - not enough light for autofocus to function.

But I'm asking too much also. This camera is a great deal for what you get in a PTZ and the images it gets of plates are excellent when properly dialed in - despite being at high distance and not an ideal angle and at night. I'm just working on how to dial in the focus consistently in an automated fashion. It's super easy to use the http API, just missing the adjustFocus API element on this model.
 

imog

n3wb
Joined
Dec 5, 2016
Messages
21
Reaction score
8
I don't have any reason to think that is the case. Furthermore, my requirement is very specific which won't affect most use cases for a PTZ - I am almost at max zoom, capturing license plates at night on moving vehicles about 150ft away. Works great when focussed properly, IR maxed, HLC at 70, shutter at 1/725, everything else default. That means I am capturing nearly pure blackness at night, until I see plates or headlights, then it's perfectly clear (with focus set manually). This also means autofocus isn't an option - once it switches to the night profile, it can't autofocus as the scene is too dark.

Plenty of other Dahua models that support adjustFocus code in the API. So if your use case is like mine, then you need to verify that model supports that adjustFocus API code. And if it does, then it's easy to set an absolute focus to ensure its always in focus for your set of conditions. If you have a reasonably lit night scene, either via IR or ambient, then autofocus will work fine for you.
 

Jeroen1000

Young grasshopper
Joined
Sep 26, 2016
Messages
42
Reaction score
13
Since this is the focus thread something has come to my attention. I can find a fair amount of suggestions, telling to focus at "near" dark to compromise on the focus shift. The goal is to have the iris open the aperture fully of close to full.
Apparently, focussing in bright weather circumstances will make focus shift worse when you use IR at night?

I also read you must do this when the camera IR is OFF and when it is in full color mode? Can anyone explain the reasoning behind this? Why in color with IR off?
 

Jeroen1000

Young grasshopper
Joined
Sep 26, 2016
Messages
42
Reaction score
13
I think I somewhat understand it now. The focus shift we are talking about here is longitudinal chromatic aberration. A lens cannot focus all colours in the same plane in the longitudinal direction: see graphical representation (red coloured section of the graphic) in the opening post. Net result: image a bit out of focus = slightly blurry.

Because the IR-wavelength(s) differs a lot from the wavelengths of visible light, we notice this effect best when lighting with IR-light vs visible light.

We have 2 options to fix it:

1) Refocus when IR-light goes on and off (the solution I Want from Dahua)
2) Use an IR-corrected lens
* Or do both for the very best result:)

So I'm not sure the advice telling you to focus at near dusk in colour before the IR-lights activate does anything at all to mitigate the longitudinal chromatic aberration.

That advice is for something else. Apparently, if the you focus with the aperture fully open at "night" (it just needs to be dark enough for the aperture to open fully), your depth of field will be better during daytime or something. I'm still trying to connect the dots
 
Last edited:

adamg

Pulling my weight
Joined
Sep 19, 2017
Messages
250
Reaction score
129
I've had Pelco tell me that they recommend focusing their manual focus/zoom cameras in dark daylight conditions rather than bright daylight conditions. Or, if it is bright conditions and I need to focus, to put a dark welder's shade lens in front of the camera so it sees a darker image, causing it to open its iris to max. Somehow this leads to the best focus for all conditions. Curious to learn if this is this open iris concept is the same reasoning as the IR wavelength focus problem.
 

Jeroen1000

Young grasshopper
Joined
Sep 26, 2016
Messages
42
Reaction score
13
I don't believe it is the same. The "open iris" thing is preserve depth of field during nightime. If you focus during daytime (on a bright day) the aperture hole is very small = large DOF. When night comes, the aperture opens up and the DOF decreases. To migitate that, it seems you have to focus with the aperture close to fully open or fully open.

The IR-blur can be fixed using my 2 suggestions and is an other problem.
 

Jeroen1000

Young grasshopper
Joined
Sep 26, 2016
Messages
42
Reaction score
13
The proof is in the pudding:)
- Scenario: I have focussed the camera 30 minutes before it would switch to B/W itself. Then, at full darkness I took 2 photo's.
1) 1ste one has been made before refocussing the camera for IR-light.
2) the 2nd has been made after refocussing the camera for IR-light.

Tips to see the difference. Switch pictures to full screen and flip between them on a 1080p screen laptop. Do not view them slightly minimised side by side. You might miss the point.

All this can be solved by a simple firmware tweak!

19u18_16-11-2017_BEFORE_FOCUS.jpg
19u18_16-11-2017_after_FOCUS.jpg
 

TVT73

Pulling my weight
Joined
Aug 29, 2016
Messages
406
Reaction score
108
Location
Germany
First of all, I didn´t see this problem on any ptz cam of dahua. They have a different autofocus function. But I only tested at max 2mp ones. The upcomming new 4MP SD Mini PTZ is maybe one candidate for having the same issues. My 2MP cams are working well.

It´s no difference when we do the refocusing at day and night view.
If we look on the focus value from web interface I can´t see a difference for refocusing all day long. It´s always the same value.

If we use only color mode it´s not necessary because of the missing ir cut and there is no chromatic aberration and only visible light.

with jeroen1000 pictures its very good to see, I don´t need to switch to full screen view or zoom in. It´s a 4mp one I mean.

I agree, a simple firmware trick will solve it and we would get a perfect picture also at night. Fore this reason I spend numerous hours in discussing it with dahua. It´s the same as the were not able to combine a switch for day/night profile to ambient light, what is is a normal behaviour for every other manufacturer of ipcams I ever used.
 
Top