patch
progress session 02.17. white board notes zum korrigieren der tiefen. arithmetisches mittel durch ausreißer versaut.
This commit is contained in:
@@ -168,7 +168,7 @@ class tutel():
|
||||
cv2.line(depth_image, (x[0],y[0]), (x[1],y[1]), (0,255,0), 2)
|
||||
for i in range(x[0], x[1]):
|
||||
for j in range(y[0], y[1]):
|
||||
self.last_depth += depth_image[j][x]
|
||||
self.last_depth += depth_image[j][i]
|
||||
self.number_of_operations += 1
|
||||
self.last_depth /= self.number_of_operations
|
||||
print(self.depth_counter, self.last_depth, self.number_of_operations)
|
||||
|
||||
@@ -108,7 +108,6 @@ class Tutel_Depth():
|
||||
y = (0,0)
|
||||
#self.number_of_operations = 0
|
||||
#x and y are swapped, because
|
||||
print(str(self.top_left[0]) + " " + str(self.top_right[0]) + " " + str(self.top_left[1]) + " " + str(self.bottom_right[1]))
|
||||
if (self.top_left[0] - self.bottom_left[0]) in range (-10,10):
|
||||
if self.top_left[0] < self.top_right[0]: x = (self.top_left[0],self.top_right[0])
|
||||
else: x = (self.top_right[0],self.top_left[0])
|
||||
@@ -119,15 +118,16 @@ class Tutel_Depth():
|
||||
else: x = (self.top_left[0],self.bottom_left[0])
|
||||
if self.bottom_left[1] < self.bottom_right[1]: y = (self.bottom_left[1],self.bottom_right[1])
|
||||
else: y = (self.bottom_right[1],self.bottom_left[1])
|
||||
cv2.line(depth_image, (x[0],y[0]), (x[1],y[1]), (0,255,0), 2)
|
||||
cv2.line(depth_image, (x[0],y[0]), (x[1],y[1]), (255,255,255), 2)
|
||||
for i in range(x[0], x[1]):
|
||||
for j in range(y[0], y[1]):
|
||||
self.last_depth += depth_image[j][x]
|
||||
print(depth_image[j][i])
|
||||
self.last_depth += depth_image[j][i]
|
||||
self.number_of_operations += 1
|
||||
self.last_depth /= self.number_of_operations
|
||||
print(self.depth_counter, self.last_depth, self.number_of_operations)
|
||||
self.number_of_operations = 0
|
||||
cv2.imshow("Tutel_Depth", depth_image)
|
||||
#cv2.imshow("Tutel_Depth", depth_image)
|
||||
if self.last_depth < self.maxMinDepth and self.last_depth != 0:
|
||||
self.depth_counter += 1
|
||||
if self.depth_counter > 0:
|
||||
@@ -154,4 +154,20 @@ class Tutel_Depth():
|
||||
|
||||
self.depth_state = True
|
||||
|
||||
return image
|
||||
return image
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 4:
|
||||
print("Please give the following arguments <turtlebot-navi-topic> and <camera-img-topic> and <camera-depth-topic>")
|
||||
print("Like: marker_attack.py /cmd_vel_mux/input/navi /camera/rgb/image_raw /camera/depth/image_raw")
|
||||
return 1
|
||||
ic = Tutel_Depth(str(sys.argv[1]),str(sys.argv[2]),str(sys.argv[3]))
|
||||
try:
|
||||
rospy.spin()
|
||||
except KeyboardInterrupt:
|
||||
print("Shutting down")
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user