简体   繁体   中英

Can someone help me to translate this line of code in java?

if (area >= 30 &&
    std::abs(1 - ((double)rect.width / (double)rect.height)) <= 0.2 && 
    std::abs(1 - (area / (CV_PI * std::pow(radius, 2)))) <= 0.2)

What I want to be translated is the std::abs and the CV_PI * std::pow .

I've search the net for std::abs equivalent to java and failed to find any. Please help. Wasn't able to search for CV_PI * std::pow since I can't still find the std::abs .

Look at the Math class.

https://docs.oracle.com/javase/7/docs/api/java/lang/Math.html

 Math.PI
 Math.pow(...)
 Math.abs(...)
 etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM