# Calculate normalized intrinsic camera matrix (cropped image)

**URL:** <https://forum.opencv.org/t/calculate-normalized-intrinsic-camera-matrix-cropped-image/2539>\
**Category:** Python\
**Tags:** calib3d\
**Created:** [April 1, 2021, 2:43pm UTC](https://forum.opencv.org/t/calculate-normalized-intrinsic-camera-matrix-cropped-image/2539 "2021-04-01T14:43:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Horst\_G](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/horst_g/32/901_2.png) [@Horst\_G](https://forum.opencv.org/u/Horst_G)\
**Post date:** [April 1, 2021, 2:43pm UTC](https://forum.opencv.org/t/calculate-normalized-intrinsic-camera-matrix-cropped-image/2539/1 "2021-04-01T14:43:24Z")

</div>

How do I calculate the normalized camera matrix of a cropped image? So I got the original camera matrix with focal length f\_x etc. Do I need to divide e.g. f\_x / width\_crop (width of cropped image) ? Or rather f\_x / width\_orig (width of original image) ? What about the principle point c\_x? I would be glad for any advices.

Best,

Horst

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [April 1, 2021, 5:46pm UTC](https://forum.opencv.org/t/calculate-normalized-intrinsic-camera-matrix-cropped-image/2539/2 "2021-04-01T17:46:45Z")

</div>

what exactly do you mean?

if you have some picture, and a crop of the picture, like so:

```python
cropped = source[y0:y1, x0:x1]

```

then only the cx, cy of the camera matrix change, and nothing else:

cx’ = cx - x0  
cy’ = cy - y0

---

<div class="post-metadata">

**Author:** ![Horst\_G](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/horst_g/32/901_2.png) [@Horst\_G](https://forum.opencv.org/u/Horst_G)\
**Post date:** [April 2, 2021, 4:06pm UTC](https://forum.opencv.org/t/calculate-normalized-intrinsic-camera-matrix-cropped-image/2539/3 "2021-04-02T16:06:19Z")

</div>

> [@crackwitz](#):
>
> change

So apparently some people divide their matrix by the resolution (e.g. fx\_normalized = fx / width) to get the matrix independend of image resolution. My question now is, how this process will change in a cropped image.

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [April 2, 2021, 9:08pm UTC](https://forum.opencv.org/t/calculate-normalized-intrinsic-camera-matrix-cropped-image/2539/4 "2021-04-02T21:08:51Z")

</div>

could you give a concrete example with numbers?

if the coefficients aren’t `fx` but `fx/width`, then you’d have to correct for that of course.

---

<div class="post-metadata">

**Author:** ![Alejandro\_Silvestri](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/alejandro_silvestri/32/357_2.png) [@Alejandro\_Silvestri](https://forum.opencv.org/u/Alejandro_Silvestri)\
**Post date:** [April 2, 2021, 11:48pm UTC](https://forum.opencv.org/t/calculate-normalized-intrinsic-camera-matrix-cropped-image/2539/5 "2021-04-02T23:48:57Z")

</div>

The normalization of the camera matrix depends on what will you do with it. OpenCV functions assume the usual plain and simple camera matrix we all know, without normalization.

The term _normalized camera matrix_ usually refers to normalizing focal length. So, you divide the matrix by the focal length to get the normalized camera matrix.  
[Camera matrix - Wikipedia](https://en.wikipedia.org/wiki/Camera_matrix#:~:text=This%20type%20of%20camera%20matrix,as%20the%203D%20coordinate%20system).

3D image generation (like openGL and such) use to have a viewport normalized with coordinates x and y in the range (-1, 1), although this viewport normalization is not common in computer vision. Augmented reality is a realm where this two world concur, and in some point it is needed to transform the camera matrix from one form to the other.

With OpenCV you may get the camera matrix and pass along to another function, without understanding what’s in it. But when normalizing, it is imperative to understand the fundamentals, and what the consumer function expects from it.

So, in your case, you can get the camera matrix for the cropped image as @crackwitz said, then apply you own normalization depending on what will you do with such matrix.
