Hikvision, focal length, angle of view and other lies

CamFan

Getting the hang of it
Joined
May 25, 2014
Messages
143
Reaction score
65
Location
California
In my prior post (http://www.ipcamtalk.com/showthread.php?2697-Hik-bullet-Install-with-custom-mounting-plates), I pondered the published angle of view of the cameras and questioned if they were horizontal or diagonal angles provided.

Turns out, the internet if full of wrong information. So with a bunch of math, pretty pictures, I present my case as to how and why what I tell you here is TRUTH.
First I started with my DS-2CD2332-I camera and this spec from HIK: http://www.hikvision.com/UploadFile/image/2014032411393544577.pdf



Well, all the angles for the different focal lengths are provided at 2 different aspect ratios, this should be a quick study and I can get back to my cold IPAs.
To calculate a horizontal FOV, all you need is the focal length and the width of the sensor. The width of the sensor might be different for the 2 aspect ratios, especially if they are giving diagonal angles, not horizontal.



My excel formula for sensor width =2*B4*TAN(RADIANS(C4)/2) – where B is focal length and C is angle of view.

Looking at the numbers, you see the sensor width changes with different lenses. So Hikvision is feeding us a load of crap and my work here is not done. The camera sensor cannot change size.

So with the Hikvision LIES, I went to the internet in search of some TRUTH. Google helped me with identifying a possible sensor, the Aptina AR0330. https://www.aptina.com/products/image_sensors/ar0330/

I moved forward with the possibility that this sensor is correct. What I care about is the sensor size, which is purported to be 5.07mm (H) x 3.38mm (V). It also has a resolution of 2304(H) x 1536(V) and a pixel size/pitch of 2.2µm.

I calculated the angles and compared them to the published angles, still not making any sense.



This calculation assumes one thing; the sensor has 2304 horizontal pixels and the output is 2048. The vertical pixels match, so I assume they are cropping 256 pixels from the sensor on the 3MP output and the effective sensor width is 4.51mm, not 5.07.

So putting the IPA back in the refrigerator, I needed to take some measurements from the camera. The old ruler trick is OK, but not very accurate. To do it properly, you need to know the principal point of the lens. http://www.cam-it.org/index.php?topic=5424.0 Here MaxIcon is assuming that the principal point is at the sensor plane. Well, that’s a bad assumption. The principal point is not a physical point, it’s an optical one (or virtual point) that could be anywhere behind the front of the lens and possibly way behind the sensor itself. Without getting too deep into it, it’s the point in the lens in which all incoming rays intersect. Like the tip of a pyramid. But, due to lightbending in the lenses, it’s not where you think it is.

And your triangle calculation, with one leg as the ruler and the other leg as this critical distance, can be wrong if your leg is wrong.

So, with the free tools online that use OpenCV to calculate intrinsic values, I was able to take some images and do all the math without rulers.

The hard GIVENs in these calculations are as follows
- Pixel size (assumed to be 2.2µm from Aptina)
- Chessboard/Checkerboard with known # of squares, known size of squares and mounted on a very flat plane.

With just this, I can calculate the ACTUAL focal length. I also get lens distortion data as well as lens principal point and lens center. Not needed for this endeavor.

So I printed a checkerboard, mounted it flat to a sheet of rigid carbon fiber and measured the actual size of the squares.

Then I setup the camera (v5.2.0 fw) to 3MP and took a series of stills and fed them to the camera calibration program.



It spits out the focal length is fx=fy=1827 pixels, so 1827 x 2.2µm= 4.02mm. Finally!, I can almost taste that hoppy beverage. The lens is 4mm, the calibration confirms it. The sensor is with great certainty the Aptina.

So you can take my FOV/Angle of View numbers above as TRUTH.

But, I couldn’t stop there. I had a 2.8mm DS-2CD2532F-IWS sitting nearby. One more data point, nothing like a double-check.

The 2.8mm camera calibration yielded a 3.25mm focal length. Ugh, uncertainty creeping back in. Grabbed the DS-2CD3332-I 2.8mm and took yet another series of photos, another calibration. Focal length = 3.20mm.

So at this point, I’m out of 2.8mm samples, BUT it appears that Hikvision is stuffing the 2.8mm cameras with 3.2mm lenses and lying to everyone. Or at least my batch.

Next I’ll tackle the 3MP vs 1080 FOV difference.
 

Attachments

Last edited by a moderator:

CamFan

Getting the hang of it
Joined
May 25, 2014
Messages
143
Reaction score
65
Location
California
PART II

So next without moving the chart or camera, I took a series of stills from the 2.8mm camera at 3MP, 1080 and 720. Nevermind the out-of-focus image, I had to get close to the camera with my chart.



I brought these into CAD to be able to scale them. Shown above, they are scaled to the output file, pixel for pixel. You can clearly see 3MP has more vertical FOV and less horizontal FOV. We also can tell that there is no image difference between the 1080 and 720 images, except they are scaled.

Next I overlaid the 3MP and the 1920x1080, but I scaled the 1920x1080 up to 2304x1296. This is the full width of the sensor, but the aspect ratio of 16:9.



What is important to see here is that the images line up perfectly. This confirms 4 things
1. In 3MP mode, the camera uses 2048 x 1536 actual pixels and crops 128pixels on each side of the image. The output is pixel for pixel to the sensor.
2. In 1080 mode, the camera uses 2304 x 1296 actual pixels and crops 120 pixels on top and bottom of the image. It outputs an 83% SCALED image.
3. In 720 mode, the camera uses 2304 x 1296 actual pixels and crops 120 pixels on top and bottom of the image. It outputs an 56% SCALED image.
4. You will never see the corners of the sensor on any output



This shows the 3 outputs of the sensor for relative scaling.



This shows the same thing, but with scaled images.

Now taking what I learned, here are the actual FOVs, based on the output you choose. This assumes the focal length is correct as advertised.



Based on this, these are the ACTUAL FOV values.
HFOV - Horizontal
VFOV - Vertical
DFOV - Diagonal

1080 and 720 have the same angles.

1080 gives you about 6 degrees more horizontal FOV than 3MP with 4mm lens.

3MP gives you about 6 degrees more vertical FOV than 3MP with 4mm lens. And it is pixel for pixel.

If you care about actual angles, measure the actual focal length first, then calculate actual angles.
 

Attachments

Last edited by a moderator:

fenderman

Staff member
Joined
Mar 9, 2014
Messages
36,901
Reaction score
21,269
Thats a lot of math..and whether its accurate or not, all the manufacturers are using similar "methods" of calculating horizontal fov... for example this dahua camera http://www.dahuasecurity.com/products/ipc-hdw4300c-620.html claims a 90 degree H fov with a 2.8mm lens...i can tell you from experience that it is just about the same as a hikvision 2032 at 4mm running at 1080p.....so basically its anyone's guess unless you compare them side by side....
 

aster1x

Getting the hang of it
Joined
Jul 8, 2014
Messages
400
Reaction score
87
PART II
.....

3MP gives you about 6 degrees more vertical FOV than 3MP with 4mm lens. And it is pixel for pixel.
Is this correct? It doesn't make sense to me. What am I missing?
 

CamFan

Getting the hang of it
Joined
May 25, 2014
Messages
143
Reaction score
65
Location
California
Is this correct? It doesn't make sense to me. What am I missing?
Yes, it is correct.

The sensor size is 2304 x 1536 pixels. You never see this many pixels at once.

In 3MP mode, the active area of the sensor is 2048 x 1536. That is also the size of the image you see (video or still), in pixels.

In 1080 mode, the active area of the sensor is 2304 x 1296. Then they scale the image down to 1920 x 1080 (83% size reduction).
 

CamFan

Getting the hang of it
Joined
May 25, 2014
Messages
143
Reaction score
65
Location
California
Thats a lot of math..and whether its accurate or not, all the manufacturers are using similar "methods" of calculating horizontal fov... for example this dahua camera http://www.dahuasecurity.com/products/ipc-hdw4300c-620.html claims a 90 degree H fov with a 2.8mm lens...i can tell you from experience that it is just about the same as a hikvision 2032 at 4mm running at 1080p.....so basically its anyone's guess unless you compare them side by side....
It's all marketing BS. That Dahua is likely using the same sensor as the Hiks. But this is likely very common in this industry.
 

aster1x

Getting the hang of it
Joined
Jul 8, 2014
Messages
400
Reaction score
87
Yes, it is correct.

The sensor size is 2304 x 1536 pixels. You never see this many pixels at once.

In 3MP mode, the active area of the sensor is 2048 x 1536. That is also the size of the image you see (video or still), in pixels.

In 1080 mode, the active area of the sensor is 2304 x 1296. Then they scale the image down to 1920 x 1080 (83% size reduction).
I am not doubting your findings but ... you say "3MP gives you about 6 degress more ..." with which lens on is this? in order to compare it with " ... than 3MP with 4mm lens". In the last part of your sentence your specify the lens but in the first you do not. So the question is,what is the lens size in the first part of your sentence?
 

CamFan

Getting the hang of it
Joined
May 25, 2014
Messages
143
Reaction score
65
Location
California
With the same lens, 4mm, you get a wider or narrower FOV depending if you use 3MP or 1080/720 on the resolution setting you use.



Here is the chart showing the difference in angle for any focal length.
 

Attachments

ServiceXp

Getting the hang of it
Joined
Feb 12, 2015
Messages
210
Reaction score
18
Location
USA
Whoa wait a second.. I don't have those options (Only 2 Resolutions) on my DS-2CD2032-I. What is up with that???
 

Attachments

ken830

n3wb
Joined
Mar 23, 2015
Messages
22
Reaction score
2
With the same lens, 4mm, you get a wider or narrower FOV depending if you use 3MP or 1080/720 on the resolution setting you use.



Here is the chart showing the difference in angle for any focal length.
I just got my first Hikvision cameras a few days ago and I'm finding the language and organization of the menus and options to be utterly confusing. From my limited experience, your calculations of the sensor/pixel sizes and scaling look correct. But I noticed there are two settings that affect FOV -- The "Resolution" setting as you have shown, and the "Capture Mode" setting" in the "Image" setting.




When "Capture Mode" is set to "Off, I can then adjust "resolution" setting and get the two different horizontal and vertical FOV as you described. When "Capture Mode" is set to "1920x1080", the "2048x1536" is not available as an option. When "Capture Mode" is set to "2048x1536", then choosing between "1920x1080" and "2048x1536" gives you the same FOV (taller, narrower) because 1920x180 stream is just a scaled/stretched version of the tall/narrow FOV of 2048x1536. Is this consistent with your observation as well.

Here's a table to describe better:
StreamResolution
Capture Mode1920*1080p2048*1536
OFFWide/Short
Tall/Narrow​
1920*1080@30fpsWide/Short-
2048*1536@20fpsTall/NarrowTall/Narrow


What I was hoping is access to (streamed or recorded) the full-size sensor resolution (2304 x 1536, as you've said), but I guess this is not possible. No matter what setting, you're cropping out some part of the image that is hitting the sensor.
 

Attachments

code2

Getting the hang of it
Joined
Mar 9, 2015
Messages
490
Reaction score
79
Location
The wild wild west
In a nut shell can some one DUMB this thread down a bit. Way to many pictures and numbers, formulas etc etc going to on even begin to know whats truth and what isn't
 
Last edited by a moderator:

fenderman

Staff member
Joined
Mar 9, 2014
Messages
36,901
Reaction score
21,269
In a nut shell can some on DUMB this thread down a bit. Way to many pictures and numbers, formulas etc etc going to on even begin to know whats truth and what isn't
Yes, a bunch of calculations were done and there is a claim that hikvisions FOV specs are inaccurate...I dont know how hikvision calculates these numbers but all the manufactures must use similar methods...everyone has a different game..some use diagonal fov numbers instead of horizontal (logitech) to make the angle seem larger when its not...
Regardless, you can still use the fov numbers to get an idea of how wide one camera will be vs another....
 

code2

Getting the hang of it
Joined
Mar 9, 2015
Messages
490
Reaction score
79
Location
The wild wild west
Yes, a bunch of calculations were done and there is a claim that hikvisions FOV specs are inaccurate...I dont know how hikvision calculates these numbers but all the manufactures must use similar methods...everyone has a different game..some use diagonal fov numbers instead of horizontal (logitech) to make the angle seem larger when its not...
Regardless, you can still use the fov numbers to get an idea of how wide one camera will be vs another....

Much better LOL thank you. Does it really matter tho honestly? I never believe the numbers put on products never have never will. I consider the info just that nothing more then a general idea. In the end it comes down to trickery all companies do it in order to make you interested in buying the product. Look how many people fall for the dvd tricks of its HD 1080p but when you look at the numbers 1 channel records 1080p while the rest record at lower frame rates. Nature of the beast i guess
 

CamFan

Getting the hang of it
Joined
May 25, 2014
Messages
143
Reaction score
65
Location
California
It mattered for me. Hiks numbers told me I'd get 79 deg coverage with 4mm cameras, I installed 2 of them on a wall hoping to cover 180 deg with minimal gap. I observed major gaps because I was only getting 58 deg x 2. It pissed me off.

Fenderman did a good job in his breakdown, but I also found the following.

- Both my 2.8mm cameras actually had 3.2mm lenses (WTF?)

- I confirmed the FOV differences between 1920x1080 and 2048x1536. The key being 1920x1080 gets you a wider FOV because the camera uses 2304 x 1296 pixels in this mode and scales it down to 1920 x 1080 output.

- in no mode can you get all the pixels off the sensor.

My guess is they measured angle of view using the flawed ruler method.
 
Top