# How to use Tan-1 in OpenCV

I want to calculate with this formula

```
tan-1(Image 1 / Image2)
```

how to implement it in OpenCV. Thank you.

This forum is disabled, please visit https://forum.opencv.org

How to use Tan-1 in OpenCV

I want to calculate with this formula

```
tan-1(Image 1 / Image2)
```

how to implement it in OpenCV. Thank you.

1

You should use phase function

```
Mat xxx = (Mat_<float>(2, 2) << 1, 2, 3, 4);
Mat yyy = (Mat_<float>(2, 2) << 1, 2, 4, 5),angle;
phase(xxx,yyy,angle);
cout<<angle;
```

results are :

```
[0.78523159, 0.78523159;
0.92740309, 0.89609587]
```

Asked: **
2017-07-03 03:16:46 -0600
**

Seen: **1,383 times**

Last updated: **Aug 01 '17**

OpenCV DescriptorMatcher matches

Conversion between IplImage and MxArray

Video On Label OpenCV Qt :: hide cvNamedWindows

Problems using the math.h class with OpenCV (c++, VS2012)

How to reduce false positives for face detection

Area of a single pixel object in OpenCV

build problems for android_binary_package - Eclipse Indigo, Ubuntu 12.04

Can't compile .cu file when including opencv.hpp

Using OpenCV's stitching module, strange error when compositing images

Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.

Not sure what you're trying to achieve. Calculating atan makes sense only if the Mat objects would contain coordinate values, something like the result of meshgrid in Matlab/Octave. You can't really calculate atan of an image - there is no such thing that I would be aware of.