# Matching pixels in orthomosaic to corresponding pixels in undistorted input images

**URL:** <https://community.pix4d.com/t/matching-pixels-in-orthomosaic-to-corresponding-pixels-in-undistorted-input-images/6012>\
**Category:** PIX4Dmapper Questions/Troubleshooting\
**Created:** [February 21, 2018, 4:54pm UTC](https://community.pix4d.com/t/matching-pixels-in-orthomosaic-to-corresponding-pixels-in-undistorted-input-images/6012 "2018-02-21T16:54:51Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Holder](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@Chris\_Holder](https://community.pix4d.com/u/Chris_Holder)\
**Post date:** [February 21, 2018, 4:54pm UTC](https://community.pix4d.com/t/matching-pixels-in-orthomosaic-to-corresponding-pixels-in-undistorted-input-images/6012/1 "2018-02-21T16:54:51Z")

</div>

How can I match pixels in my output orthomosaic to the corresponding pixels in my undistorted input images?

I am aware of the output pmatrix file which can be used to match point cloud vertices to image pixels, can this also be used for the orthomosaic?

---

<div class="post-metadata">

**Author:** ![Chris\_Holder](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@Chris\_Holder](https://community.pix4d.com/u/Chris_Holder)\
**Post date:** [February 22, 2018, 3:09pm UTC](https://community.pix4d.com/t/matching-pixels-in-orthomosaic-to-corresponding-pixels-in-undistorted-input-images/6012/2 "2018-02-22T15:09:13Z")

</div>

I’m trying to work this out following the formula from&nbsp;[https://support.pix4d.com/hc/en-us/articles/202977149-What-does-the-Output-Params-Folder-contain-#label12](https://support.pix4d.com/hc/en-us/articles/202977149-What-does-the-Output-Params-Folder-contain-#label12) but I’m hitting a bit of a road block. Presumably I can get the X and Y coordinates of any pixel in the orthomosaic by using the world file (world coordinates + pixel location \* pixel size), and the Z coordinate from the DSM, however when I multiply these coordinates by a matrix from the [project]\_pmatrix.txt file I get some very large values, so I tried doing the same with the point cloud and got the same results.

Let’s say I pick a point from my cloud in the Pix4D Mapper desktop app: the point coordinates (X, Y, Z) are (612834, 6022815, 334) using WGS84. The app shows me several images which contain this point, and I pick one where the pixel coordinates corresponding to my chosen point are (1499, 1112) in an image of size 4000 x 3000. I take the matrix corresponding to this image and multiply it with the point coordinates to get a new set of coordinates (x,y,z) which gives(14190732177, 4139527026, 723498). Dividing x and y by z gives me a pixel location of (19614, 5799), which is clearly incorrect.

What am I doing wrong?&nbsp;Some of the matrix values look a bit odd, so I’ve copied it below; could this be the culprit?&nbsp;My map is ~650m by ~450m at a resolution of ~3cm.

115.596942&nbsp; &nbsp;2344.501702 -1828.104356 15491.701779  
2434.055636 449.028246&nbsp; &nbsp;-923.594688&nbsp; &nbsp;-340498.232885  
0.227681&nbsp; &nbsp; &nbsp; &nbsp;0.097014&nbsp; &nbsp; &nbsp; &nbsp;-0.968891&nbsp; &nbsp; &nbsp; &nbsp;-18.233849

&nbsp;

---

<div class="post-metadata">

**Author:** ![Pierangelo\_Rothenbuhler](https://sea2.discourse-cdn.com/pix4d/user_avatar/community.pix4d.com/pierangelo_rothenbuhler/32/2439_2.png) [@Pierangelo\_Rothenbuhler](https://community.pix4d.com/u/Pierangelo_Rothenbuhler)\
**Post date:** [February 28, 2018, 1:33pm UTC](https://community.pix4d.com/t/matching-pixels-in-orthomosaic-to-corresponding-pixels-in-undistorted-input-images/6012/3 "2018-02-28T13:33:29Z")

</div>

I also tried to use the pmatrix and it does not seem to work right now. We do not actively support these output files and do not have any ressources to allocate to investigate this issue for the moment.&nbsp;

You can&nbsp;use the project\_name\_calibrated\_camera\_parameters file instead. This one is used by our Cloud team for the 3D inspector and works well for perspective cameras. Hope this is an acceptable workaround!

---

<div class="post-metadata">

**Author:** ![vHive](https://avatars.discourse-cdn.com/v4/letter/v/ce73a5/32.png) [@vHive](https://community.pix4d.com/u/vHive)\
**Post date:** [March 1, 2018, 1:24pm UTC](https://community.pix4d.com/t/matching-pixels-in-orthomosaic-to-corresponding-pixels-in-undistorted-input-images/6012/4 "2018-03-01T13:24:51Z")

</div>

Hi,&nbsp;&nbsp;

I am also having the same problem and the proposed workaround does not work for me, I get the same results I am getting with pmatrix.&nbsp;

I am also selecting the a point from the rayCloud and using its computed position values (in meters WGS84) as the input vector (X,Y,Z).

The result I am getting with both pmatrix and with the longer computation suggested using&nbsp;calibrated\_camera\_parameters file, are not in the range of pixels location in the image (u,v=(64995.18738050609, -2451.1417401108715)).

How would you suggest to find what goes wrong here?

&nbsp;

Thanks

---

<div class="post-metadata">

**Author:** ![Zohaib\_Khan](https://avatars.discourse-cdn.com/v4/letter/z/958977/32.png) [@Zohaib\_Khan](https://community.pix4d.com/u/Zohaib_Khan)\
**Post date:** [March 27, 2018, 11:41pm UTC](https://community.pix4d.com/t/matching-pixels-in-orthomosaic-to-corresponding-pixels-in-undistorted-input-images/6012/5 "2018-03-27T23:41:47Z")

</div>

Hi,

I have run into exactly the same problem and have lost a fair bit of time trying to resolve the issue. Pix4D must come with a solution to this problem as it is a very important issue. How can you say that you will not support the output files generated with Pix4D when your website itself refers to these files for various purposes.

---

<div class="post-metadata">

**Author:** ![Chris\_Holder](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@Chris\_Holder](https://community.pix4d.com/u/Chris_Holder)\
**Post date:** [March 28, 2018, 9:51am UTC](https://community.pix4d.com/t/matching-pixels-in-orthomosaic-to-corresponding-pixels-in-undistorted-input-images/6012/6 "2018-03-28T09:51:49Z")

</div>

Agreed, it is a bit rubbish. That’s why I’ve moved over to Photoscan.

---

<div class="post-metadata">

**Author:** ![Antigoni\_Makri](https://sea2.discourse-cdn.com/pix4d/user_avatar/community.pix4d.com/antigoni_makri/32/187_2.png) [@Antigoni\_Makri](https://community.pix4d.com/u/Antigoni_Makri)\
**Post date:** [April 12, 2018, 7:35am UTC](https://community.pix4d.com/t/matching-pixels-in-orthomosaic-to-corresponding-pixels-in-undistorted-input-images/6012/7 "2018-04-12T07:35:14Z")

</div>

Hello all,

We took into consideration your comments and we apologize for any inconvenience caused.  
Our Team has further investigated the cause of the issue and it was discovered that a constant shift should be applied to the 3D coordinates that refer to the output coordinate system before using the pmatrix. The offset should be subtracted from the 3D coordinate and it is located in the _project\_name\_offset.xyz_ file.  
For more information check again our updated [article](https://support.pix4d.com/hc/en-us/articles/202977149#label12).

We encourage you to share your experience on this post, so that the Community can be helped.

Regards,

---

<div class="post-metadata">

**Author:** ![Chris\_Holder](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@Chris\_Holder](https://community.pix4d.com/u/Chris_Holder)\
**Post date:** [April 12, 2018, 2:38pm UTC](https://community.pix4d.com/t/matching-pixels-in-orthomosaic-to-corresponding-pixels-in-undistorted-input-images/6012/8 "2018-04-12T14:38:41Z")

</div>

Thanks, that’s great. I tried processing my data again with the new information and it works perfectly now.

&nbsp;

When I originally posted I was using a free trial to evaluate whether Pix4D was suitable for my needs, which now has obviously expired. Would it be possible to get another free trial so that I may reevaluate Pix4D now that I know how to properly use the output?

---

<div class="post-metadata">

**Author:** ![Zohaib\_Khan](https://avatars.discourse-cdn.com/v4/letter/z/958977/32.png) [@Zohaib\_Khan](https://community.pix4d.com/u/Zohaib_Khan)\
**Post date:** [April 13, 2018, 7:12am UTC](https://community.pix4d.com/t/matching-pixels-in-orthomosaic-to-corresponding-pixels-in-undistorted-input-images/6012/9 "2018-04-13T07:12:50Z")

</div>

Thanks. It works with the updated information.

---

<div class="post-metadata">

**Author:** ![Antigoni\_Makri](https://sea2.discourse-cdn.com/pix4d/user_avatar/community.pix4d.com/antigoni_makri/32/187_2.png) [@Antigoni\_Makri](https://community.pix4d.com/u/Antigoni_Makri)\
**Post date:** [April 13, 2018, 8:55am UTC](https://community.pix4d.com/t/matching-pixels-in-orthomosaic-to-corresponding-pixels-in-undistorted-input-images/6012/10 "2018-04-13T08:55:55Z")

</div>

Hello all,

I am glad that it works well for you now. Please let us know in case you encounter any further issues.

@Chris: You can ask for a new Trial in the software and a second 10-day Trial version will be added to your account.

Regards,

---

<div class="post-metadata">

**Author:** ![Vamsi\_Revada](https://avatars.discourse-cdn.com/v4/letter/v/3ab097/32.png) [@Vamsi\_Revada](https://community.pix4d.com/u/Vamsi_Revada)\
**Post date:** [June 18, 2018, 5:45am UTC](https://community.pix4d.com/t/matching-pixels-in-orthomosaic-to-corresponding-pixels-in-undistorted-input-images/6012/11 "2018-06-18T05:45:14Z")

</div>

Hi,

Is there a way to find 3D location (X,Y,Z) of a pixel location given image p-matrix and offset. Just i want to reverse the above process that finding a 3d point location from 2d un-distorted image pixel location.

&nbsp;

Thank you

---

<div class="post-metadata">

**Author:** ![Antigoni\_Makri](https://sea2.discourse-cdn.com/pix4d/user_avatar/community.pix4d.com/antigoni_makri/32/187_2.png) [@Antigoni\_Makri](https://community.pix4d.com/u/Antigoni_Makri)\
**Post date:** [June 26, 2018, 2:21pm UTC](https://community.pix4d.com/t/matching-pixels-in-orthomosaic-to-corresponding-pixels-in-undistorted-input-images/6012/12 "2018-06-26T14:21:57Z")

</div>

Hello Vamsi,

There is no separate output that allows the conversion of the 2D undistorted image coordinates to the 3D location. You could maybe try to use the inverted _pmatrix_&nbsp;output in order to get these values.&nbsp;

Regards,
