Ask Your Question

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

asked 2015-12-03 12:19:08 -0500

Raymond gravatar image

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

edit retag flag offensive close merge delete



Are you serious? Googling "std::abs java" offers this page as first hit

LorenaGdL gravatar imageLorenaGdL ( 2015-12-03 12:24:23 -0500 )edit

@LorenaGdL: You are wasting everyones time by posting that as comment instead of providing the answer.

RolandC gravatar imageRolandC ( 2015-12-04 01:44:21 -0500 )edit

@RolandC who is everyone, what the hell are you talking about? Do I have to post an answer just because you say so? 1) I won't answer some lazy user who didn't even do a basic Google search, and 2) this isn't even OpenCV related, it's about basic C++ and Java

LorenaGdL gravatar imageLorenaGdL ( 2015-12-04 02:30:53 -0500 )edit

@RolandC, please if you have no useful comments then do not add them ... @LorenaGdL is an active and dedictated user supplying tons of answers and solutions for people. It is basically normal that she does not provide solutions to people who are to lazy to use a simple search engine. The guidelines of this forum clearly state that this forum is a two way effort. If that effort is missing at the user posting the question, then you cannot expect us to be eagerly to help.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-12-04 04:44:56 -0500 )edit

@StevenPuttemans she, please :P

LorenaGdL gravatar imageLorenaGdL ( 2015-12-04 04:49:44 -0500 )edit

changed :D

StevenPuttemans gravatar imageStevenPuttemans ( 2015-12-04 06:07:51 -0500 )edit

@StevenPuttemans: What's worse? Someone not googling or someone saying google it yourself when the answer is just a few lines. Clearly @Raymond doesn't know how to program. As someone who likes to help others, I read the question only to see that comment by @LorenaGdL. A waste of time. Why does she write at all instead of simply ignoring the user? And regarding "no useful comments", what's her "she, please :P" and your "changed :D" then?

RolandC gravatar imageRolandC ( 2015-12-05 00:59:38 -0500 )edit

@RolandC I won't engage in an argument because this is not what it's expected in this forum (and that's also why your 1st comment is out of place). Just saying that if the user don't know how to program and/or do a basic search, then I feel answering him is not gonna help at all. What he must do is start by learning basic programming things, and then he must put effort in it before trying others to solve every little hitch he finds. In fact, my "useless" comment has a link to the answer. And also, ignoring the user won't make him aware of what's expected from him here in the forum. If you don't share my vision, that's alright, answer him, but please don't tell me (nor other users here) what I should do. We're all here ...(more)

LorenaGdL gravatar imageLorenaGdL ( 2015-12-05 02:25:59 -0500 )edit

sorry for this, though I appreciate the help. I just wanted to clarify though that I googled it for a long time and didn't find the answer. Then when I use the keyword provided by LorenaGdL it appears. I will reflect in this action and won't do it again next time. Though I am glad that RolandC helped me out in my question. At first I thought that it was opencv line of code as I am new to opencv and not familiar with C and as I search I wasn't able to find it. Sincerely I apologize for this question and very thankful for the answer.

Raymond gravatar imageRaymond ( 2015-12-05 07:45:53 -0500 )edit

@RolandC like I said, I am not going to apologise on the way I am organising this forum. There is a reason why OpenCV developers gave us the privilege of managing it, just because they like our style of working and the way we engage with people. As to random useless comments, true, they could be left out, but lets say that 90% of our comments actually help out users, which is much higher then the average answer rate of the average forum user. @Raymond, no sorry needed ... this somewhat exploded due to the reactions, but as long as next time you first put in a little bit of more effort, all will be fine. Welcome to the community!

StevenPuttemans gravatar imageStevenPuttemans ( 2015-12-06 05:39:15 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-12-04 01:42:32 -0500

RolandC gravatar image
if (area >= 30 && Math.abs(1 - ((double)rect.width / (double)rect.height)) <= 0.2 && Math.abs(1 - (area / (Math.PI * Math.pow(radius, 2)))) <= 0.2)
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-12-03 12:19:08 -0500

Seen: 395 times

Last updated: Dec 04 '15