Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

does opencv has a definition for PI (3.14...)

Tags:

c++

opencv

I am writting code that uses opencv and i need to have access to PI (3.14...), I know that standard math.h has the efinition, but I found it not easy to uses it is not exposed by default.

Does OpenCV has any definition for PI?

like image 818
mans Avatar asked Jul 02 '15 11:07

mans


People also ask

What is the function of OpenCV?

OpenCV is the huge open-source library for the computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in today's systems. By using it, one can process images and videos to identify objects, faces, or even handwriting of a human.

Does C++ have pi?

Master C and Embedded C Programming- Learn as you go Here we will see how to use the PI constant in C++ program. The PI constant is present in the cmath header file. The name of the constant is M_PI. We can simply include that header file, and use the constant to perform operation.

How do you find PI in C?

Using Constants in C: In this program the value of π is defined in two different ways. One is by using using the preprocessor directive '#define' to make 'PI' equal to 3.142857. The other uses the key work 'const' to define a double called 'pi' equal to 22.0/7.0.


3 Answers

Yes. It defines CV_PI.

I think it's defined in the cv namespace.

Edit: At a closer look it seems that it's available in the global namespace.

like image 129
Radu Diță Avatar answered Oct 22 '22 18:10

Radu Diță


In OpenCV python, it seems CV_PI (or cv2.CV_PI) doesn't exist, use numpy.pi.

like image 11
calocedrus Avatar answered Oct 22 '22 18:10

calocedrus


Currently CV_PI seems to be in cvdef.h, line 193:

cvdef.h

cvdef.h line 193

#define CV_PI   3.1415926535897932384626433832795

I can confirm as others have mentioned that cv::PI does not seem to be available any longer (probably removed in the OpenCV 2 to OpenCV 3 change over when the OpenCV 1 legacy stuff was depreciated).

like image 1
cdahms Avatar answered Oct 22 '22 16:10

cdahms