I've created a formula with polynomial regression to calculate a drag point from an input. I tested the formula in a separate file with the input, and the output appears to be working as intended. However, in the actual file, it seems to be outputting tremendously incorrect numbers. My first thought was that the output style for OpenCV was in some odd format for the numbers, but when I printed the values they were just fine. It appears to work just fine with smaller formulas, but gives wild values for my created formula. Any help would be appreciated. Below are the formulae for calculating the x and y with a test input and a correct output, vs what I'm getting in the actual file. Thanks.
def triang_x(x1):
x2 = (-6.8808613455609384e+005) + (3.2312735687925651e+003 * x1)
+ (-6.0019455279289815e+000 * x1**2) + (1.0786025430222985e-002 * x1**3)
+ (-2.8031333306353576e-005 * x1**4) + (4.7125204049478773e-008 * x1**5)
+ (-3.8733353649642116e-011 * x1**6) + (1.4733899082497896e-014 * x1**7)
+ (-5.1033986030610612e-018 * x1**8) + (2.7445807881521161e-021 * x1**9)
+ (1.4039325861603808e-024 * x1**10) + (-7.8303365296494140e-027 * x1**11)
+ (2.0700235162417034e-029 * x1**12) + (-2.5633522287710555e-032 * x1**13)
+ (1.4236656075804622e-035 * x1**14) + (-2.9388878284829885e-039 * x1**15)
return x2
def triang_y(y1):
y2 = ((2.9536073194970668e+004) + (-7.2584981060026985e+002 * y1)
+ (5.9991721893954519e+000 * y1**2) + (-1.4273839368311947e-002 * y1**3)
+ (-6.1205911580247642e-005 * y1**4) + (4.1603526512587676e-007 * y1**5)
+ (-6.9546008738218303e-010 * y1**6) + (-1.1072665851528698e-013 * y1**7)
+ (-6.4446469064614884e-016 * y1**8) + (8.0190196135612936e-018 * y1**9)
+ (-8.8768139841444641e-021 * y1**10) + (-1.3685149110264805e-023 * y1**11)
+ (1.3193560897991867e-026 * y1**12) + (5.4138560249698032e-029 * y1**13)
+ (-9.5141032455036651e-032 * y1**14) + (4.4497796299711634e-035 * y1**15))
return y2
# Test Values are x:1116 y:398
#Correct Output is x:900.892612375319 y:889.0486684303542
#Output received in main is 10415680.385044796 -167144.0485716732