Using vari-focal camera to determine focal length of fixed-focus camera

Iemand91

Pulling my weight
Joined
Aug 12, 2016
Messages
252
Reaction score
199
Location
Netherlands
I've read several times on this (very informative by the way) forum using this technique.
I'm planning to do this too: New setup: 2 camera's and a NVR

But here's the question; how exactly do you do that?
Personally, I have the IPC-HDW5231R-ZE which goes from 2.7mm to 13.5mm.
For another setup, I want to use 2 IPC-HDW4231EM-ASE camera's to save some money.
(it would save him about €40 p/camera).
Now that camera is available in 3 versions; 2.8mm, 3.6mm and 6mm, all within the focal range of my camera.

But how do you know when you're in the webinterface zooming in and out at what focal length you're at?
The slider goes from 0 - 2390, 0 at 2.7mm and 2390 at 13.5mm.
If you would convert that 0-2390 number to a 2.8, 3.6 and 6mm focal length; that would equate to:

2.8mm = 22.13
3.6mm = 199.17
6mm = 720.27

Or, a much better way:
Good question... I'm not 100% sure what the answer is, but I will take a stab.

The Dahua api takes a range of 0.0-1.0, with 1 being max zoom, and we will assume the software and hardware are linear.

Let Fmin and Fmax be the max and min focal lengths, F be the actual focal length of the lens, and f be the API input zoom value. We can form the working equation:

f(F) = (F - Fmin) / (Fmax - Fmin)

Now we can easily solve for the API zoom values that give a 2.8, 3.6, and 6mm equivalent focal lengths on a 2.7-13.5mm zoom camera:

f(2.8mm) = 0.009259
f(3.6mm) = 0.08333
f(6mm) = 0.3056

Again, this is just an educated guess that assumes some things, but it might be right.

Kevin
His maths results in this:

hmm, the webui slider implementation may be using 2560, but the Dahua API takes a float in the range 0.0-1.0. You can interpolate the 0-2560 range to 0-1 and use the camera's web interface (I like this math approach, hehe... please share the working equation if you do that), or you can use the api by entering something like this in your browser (no plugins needed so chrome will work):

Code:
http://user:password@ipaddress/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.071429&zoom=0.0833
Of course, replace the user, password, ipaddress, and zoom & focus values to match your setup. The API method is faster/simpler for me, but either way would work. It is a tad annoying the API doesn't have zoom broken out without having to set focus at the same time. If you need to get the current focus value from your camera, use this:

Code:
http://user:password@ipaddress/cgi-bin/devVideoInput.cgi?action=getFocusStatus
I'll also note that these web API commands can be used alone, or while you're viewing video with the cam webui or VMS (stream).
However, this all theoretical assuming (like @truglo said) the software and hardware are linear.

Has anybody used this method of using a vari-focal length camera to determine the focal length for a fixed-focus camera? And if yes, how?
 

Philip Gonzales

Getting comfortable
Joined
Sep 20, 2017
Messages
697
Reaction score
551
Sounds like you need to test this :D. I would be very curious to know if this works.
 

Iemand91

Pulling my weight
Joined
Aug 12, 2016
Messages
252
Reaction score
199
Location
Netherlands
So all the times I've read on this forum about using a vari-focal camera to determine the focal length of a fixed focus camera is pretty much based on wild guessing?
 

wopi82

IPCT Contributor
Joined
Feb 9, 2017
Messages
117
Reaction score
800
Location
Poland
@lemand91
I haven’t heard of the method you mention, but I did a quick preview for you. If your starting point is 2.7mm than here is what would 2.8mm, 3.6mm and 6mm look like. You can use it as a template :)

fov_preset.jpg

General role is, if you have fullHD image with 2202 pixels in diagonal and your lens is, say 3mm, than if you use 6mm lens, your field of view will be half diagonal of the initial image. Knowing that dependence and your starting focal length, you can determine every lens FOV.
 

Iemand91

Pulling my weight
Joined
Aug 12, 2016
Messages
252
Reaction score
199
Location
Netherlands
Today I dismounted my IPC-HDW5231R-ZE and took it to my brothers house trying to figure out what lens he needs on the IPC-HDW4231EM-ASE.
I tried both using the slider and @truglo s method with the URL's.
I will compare them tomorrow, but my first impression is that they are pretty much the same.

I do know we'll likely mount one camera in portrait mode and the other in landscape mode.
It's a b*tch to look at portrait videos, but if there's actual more information that way, it'll do.

Then on to @EMPIRETECANDY to order some camera's, junction boxes and NVR (maybe a NVR for me too).
What method of contacting do you prefer Andy? Email, private message on this forum, message on Aliexpress or?
 

Fastb

Known around here
Joined
Feb 9, 2016
Messages
1,342
Reaction score
934
Location
Seattle, Wa
It's a b*tch to look at portrait videos, but if there's actual more information that way, it'll do.
Look into "Hallway Mode". It's a config setting in the camera that rotates the image 90 degrees, for hallway applications.....
 

EMPIRETECANDY

IPCT Vendor
Joined
Nov 8, 2016
Messages
8,294
Reaction score
23,854
Location
HONGKONG
Today I dismounted my IPC-HDW5231R-ZE and took it to my brothers house trying to figure out what lens he needs on the IPC-HDW4231EM-ASE.
I tried both using the slider and @truglo s method with the URL's.
I will compare them tomorrow, but my first impression is that they are pretty much the same.

I do know we'll likely mount one camera in portrait mode and the other in landscape mode.
It's a b*tch to look at portrait videos, but if there's actual more information that way, it'll do.

Then on to @EMPIRETECANDY to order some camera's, junction boxes and NVR (maybe a NVR for me too).
What method of contacting do you prefer Andy? Email, private message on this forum, message on Aliexpress or?
send me email is easy, thanks.
 

Iemand91

Pulling my weight
Joined
Aug 12, 2016
Messages
252
Reaction score
199
Location
Netherlands
Look into "Hallway Mode". It's a config setting in the camera that rotates the image 90 degrees, for hallway applications.....
I know, I used that too.

Still; it's not the nicest look is it? :p
send me email is easy, thanks.
Thanks, will do.

Just figuring out what lens we need, it's actually pretty difficult.
So it will take some time to decide.
 
Last edited:

tibimakai

Known around here
Joined
May 8, 2017
Messages
1,023
Reaction score
513
Location
Los Angeles
I know it's an old post, but I did not want to start a new one.
I'm trying to replace the two 5231R-Z cams, that are left and right from the garage door, they are overviewing the driveway, with the new 5442 fixed lens cams and I'm not sure which one should I get, the 3.6MM, or the 2.8MM?
 
Top