Unverified Commit d551b9bf authored by tilman's avatar tilman
Browse files

save current working copy

parent 210421f7
......@@ -13,13 +13,14 @@ BISEC_VECTORS = True
CORRECTION_ANGLE = 0
img_name = "/Users/Tilman/Documents/Programme/Python/forschungspraktikum/art-structures-env/src/images/images_imdahl/Judas_und_Christus.jpg"
pose = np.array([[4.7613028e+02,3.3695804e+02,9.0203685e-01],[5.3667474e+02,3.8633786e+02,6.6615295e-01],[5.1645105e+02,3.8405157e+02,5.1514143e-01],[0.0000000e+00,0.0000000e+00,0.0000000e+00],[0.0000000e+00,0.0000000e+00,0.0000000e+00],[5.5459924e+02,3.8859457e+02,6.4240879e-01],[5.6353766e+02,4.7384988e+02,1.8810490e-01],[5.3886292e+02,5.2543573e+02,9.0144195e-02],[5.4566248e+02,5.3215259e+02,3.6083767e-01],[5.2768524e+02,5.3213129e+02,3.1196830e-01],[5.4556714e+02,6.3534674e+02,1.8182488e-01],[5.8149310e+02,7.2958716e+02,1.3625422e-01],[5.6579541e+02,5.3216382e+02,3.6866242e-01],[5.8822272e+02,6.2862476e+02,1.7708556e-01],[6.0843213e+02,7.2955762e+02,2.2736737e-01],[4.7597812e+02,3.2798129e+02,5.7176876e-01],[4.8729745e+02,3.3027243e+02,9.1296065e-01],[0.0000000e+00,0.0000000e+00,0.0000000e+00],[5.2090784e+02,3.3472034e+02,7.7942842e-01],[5.7928674e+02,7.5646222e+02,2.0351715e-01],[5.9049512e+02,7.5648248e+02,2.0819387e-01],[6.2183606e+02,7.3853394e+02,1.7312977e-01],[5.8145673e+02,7.5420642e+02,1.2660497e-01],[5.7701074e+02,7.5417773e+02,1.2881383e-01],[5.8374255e+02,7.3627380e+02,9.4869599e-02]])
# pose = np.array([[5.3406028e+02,3.3695804e+02,9.0203685e-01],[5.3667474e+02,3.8633786e+02,6.6615295e-01],[5.1645105e+02,3.8405157e+02,5.1514143e-01],[0.0000000e+00,0.0000000e+00,0.0000000e+00],[0.0000000e+00,0.0000000e+00,0.0000000e+00],[5.5459924e+02,3.8859457e+02,6.4240879e-01],[5.6353766e+02,4.7384988e+02,1.8810490e-01],[5.3886292e+02,5.2543573e+02,9.0144195e-02],[5.4566248e+02,5.3215259e+02,3.6083767e-01],[5.2768524e+02,5.3213129e+02,3.1196830e-01],[5.4556714e+02,6.3534674e+02,1.8182488e-01],[5.8149310e+02,7.2958716e+02,1.3625422e-01],[5.6579541e+02,5.3216382e+02,3.6866242e-01],[5.8822272e+02,6.2862476e+02,1.7708556e-01],[6.0843213e+02,7.2955762e+02,2.2736737e-01],[4.7597812e+02,3.2798129e+02,5.7176876e-01],[4.8729745e+02,3.3027243e+02,9.1296065e-01],[0.0000000e+00,0.0000000e+00,0.0000000e+00],[5.2090784e+02,3.3472034e+02,7.7942842e-01],[5.7928674e+02,7.5646222e+02,2.0351715e-01],[5.9049512e+02,7.5648248e+02,2.0819387e-01],[6.2183606e+02,7.3853394e+02,1.7312977e-01],[5.8145673e+02,7.5420642e+02,1.2660497e-01],[5.7701074e+02,7.5417773e+02,1.2881383e-01],[5.8374255e+02,7.3627380e+02,9.4869599e-02]])
# pose = np.array([[4.7613028e+02,3.3695804e+02,9.0203685e-01],[5.3667474e+02,3.8633786e+02,6.6615295e-01],[5.1645105e+02,3.8405157e+02,5.1514143e-01],[0.0000000e+00,0.0000000e+00,0.0000000e+00],[0.0000000e+00,0.0000000e+00,0.0000000e+00],[5.5459924e+02,3.8859457e+02,6.4240879e-01],[5.6353766e+02,4.7384988e+02,1.8810490e-01],[5.3886292e+02,5.2543573e+02,9.0144195e-02],[5.4566248e+02,5.3215259e+02,3.6083767e-01],[5.2768524e+02,5.3213129e+02,3.1196830e-01],[5.4556714e+02,6.3534674e+02,1.8182488e-01],[5.8149310e+02,7.2958716e+02,1.3625422e-01],[5.6579541e+02,5.3216382e+02,3.6866242e-01],[5.8822272e+02,6.2862476e+02,1.7708556e-01],[6.0843213e+02,7.2955762e+02,2.2736737e-01],[4.7597812e+02,3.2798129e+02,5.7176876e-01],[4.8729745e+02,3.3027243e+02,9.1296065e-01],[0.0000000e+00,0.0000000e+00,0.0000000e+00],[5.2090784e+02,3.3472034e+02,7.7942842e-01],[5.7928674e+02,7.5646222e+02,2.0351715e-01],[5.9049512e+02,7.5648248e+02,2.0819387e-01],[6.2183606e+02,7.3853394e+02,1.7312977e-01],[5.8145673e+02,7.5420642e+02,1.2660497e-01],[5.7701074e+02,7.5417773e+02,1.2881383e-01],[5.8374255e+02,7.3627380e+02,9.4869599e-02]])
pose = np.array([[5.9406028e+02,3.3695804e+02,9.0203685e-01],[5.3667474e+02,3.8633786e+02,6.6615295e-01],[5.1645105e+02,3.8405157e+02,5.1514143e-01],[0.0000000e+00,0.0000000e+00,0.0000000e+00],[0.0000000e+00,0.0000000e+00,0.0000000e+00],[5.5459924e+02,3.8859457e+02,6.4240879e-01],[5.6353766e+02,4.7384988e+02,1.8810490e-01],[5.3886292e+02,5.2543573e+02,9.0144195e-02],[5.4566248e+02,5.3215259e+02,3.6083767e-01],[5.2768524e+02,5.3213129e+02,3.1196830e-01],[5.4556714e+02,6.3534674e+02,1.8182488e-01],[5.8149310e+02,7.2958716e+02,1.3625422e-01],[5.6579541e+02,5.3216382e+02,3.6866242e-01],[5.8822272e+02,6.2862476e+02,1.7708556e-01],[6.0843213e+02,7.2955762e+02,2.2736737e-01],[4.7597812e+02,3.2798129e+02,5.7176876e-01],[4.8729745e+02,3.3027243e+02,9.1296065e-01],[0.0000000e+00,0.0000000e+00,0.0000000e+00],[5.2090784e+02,3.3472034e+02,7.7942842e-01],[5.7928674e+02,7.5646222e+02,2.0351715e-01],[5.9049512e+02,7.5648248e+02,2.0819387e-01],[6.2183606e+02,7.3853394e+02,1.7312977e-01],[5.8145673e+02,7.5420642e+02,1.2660497e-01],[5.7701074e+02,7.5417773e+02,1.2881383e-01],[5.8374255e+02,7.3627380e+02,9.4869599e-02]])
img = cv2.imread(img_name)
bisecVector = poseToBisectVector(pose, CORRECTION_ANGLE)
cv2.arrowedLine(img, trp(bisecVector[1]), trp(bisecVector[0]), (0,0,255), 2)
cv2.arrowedLine(img, trp(pose[1]), trp(pose[0]), (0,255,0), 2)
cv2.arrowedLine(img, (int(pose[1][0]-50),int(pose[1][1])), trp(pose[1]), (255,0,0), 2)
cv2.arrowedLine(img, trp(pose[1]), trp(pose[8]), (0,255,0), 2)
cv2.namedWindow(img_name, cv2.WINDOW_NORMAL)
......
......@@ -24,19 +24,30 @@ def getAngle(a,b,c, CORRECTION_ANGLE): #checked is correct
# print("right angle",angle,np.rad2deg(angle))
# angle = 180 - angle #+ np.deg2rad(CORRECTION_ANGLE)
return angle
def getAngleGroundNormed(a,b,c, CORRECTION_ANGLE):
vector_angle = getAngle(a,b,c, CORRECTION_ANGLE)
ground_angle = getAngle(a,b,np.array([b[1]-10,b[1]]), CORRECTION_ANGLE)
normed_angle = vector_angle/2 - ground_angle
print("points",a,b,c,np.array([b[1]-10,b[1]]))
print("angles",np.rad2deg(vector_angle),np.rad2deg(ground_angle),np.rad2deg(normed_angle))
return (normed_angle+np.deg2rad(180))
#return (normed_angle)
# ground_angle = getAngle(a,b,c, CORRECTION_ANGLE)
def getGlobalLineAngle(poses, CORRECTION_ANGLE):
return np.mean([getAngle(*pose[[0,1,8]][:,:2], CORRECTION_ANGLE) for pose in poses if not 0.0 in pose[[0,1,8]][:,2:]])
def getBisecPoint(a,b,c, CORRECTION_ANGLE):
angle = getAngle(a,b,c, CORRECTION_ANGLE)
print("getBisecPoint-getAngle full",angle,np.rad2deg(angle))
angle = angle / 2
angle = getAngleGroundNormed(a,b,c, CORRECTION_ANGLE)
# getAngleGroundNormed(a,b,c, CORRECTION_ANGLE)
# print("getBisecPoint-getAngle full",angle,np.rad2deg(angle))
# angle = angle / 2
print("getBisecPoint-getAngle half",angle,np.rad2deg(angle))
dist = la.norm(a-b)
# dist = 100
d = (int(dist * np.cos(angle)), int(dist * np.sin(angle))) #with origin zero
return (d[0]+b[0],d[1]+b[1]) #with origin b
out = (b[0]+d[0],b[1]-d[1])
print("d",d,"b",b,"out",out)
return out #with origin b
def getBisecCone(a,b,c,width, CORRECTION_ANGLE):
angle = getAngle(a,b,c, CORRECTION_ANGLE)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment