Dateien nach "tutel" hochladen
This commit is contained in:
+18
-7
@@ -72,7 +72,7 @@ class tutel():
|
||||
def callback_rgb(self, data):
|
||||
try:
|
||||
rgb_image = self.rgb_bridge.imgmsg_to_cv2(data, "bgr8")
|
||||
cv2.rotate(rgb_image, cv2.ROTATE_180, rgb_image)
|
||||
#cv2.rotate(rgb_image, cv2.ROTATE_180, rgb_image)
|
||||
(self.h, self.w) = rgb_image.shape[:2]
|
||||
except CvBridgeError as e:
|
||||
print(e)
|
||||
@@ -105,7 +105,7 @@ class tutel():
|
||||
def callback_depth(self, data):
|
||||
if self.depth_state:
|
||||
depth_image = self.depth_bridge.imgmsg_to_cv2(data, "passthrough")
|
||||
cv2.rotate(depth_image, cv2.ROTATE_180, depth_image)
|
||||
#cv2.rotate(depth_image, cv2.ROTATE_180, depth_image)
|
||||
if self.depth_counter == 0:
|
||||
#pass
|
||||
#self.last_depth = 10.0
|
||||
@@ -123,13 +123,24 @@ class tutel():
|
||||
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])
|
||||
depth_values = []
|
||||
for i in range(x[0], x[1]):
|
||||
M = ((x[0] + (x[1]-x[0])//2), y[0]+(y[1]-y[0]//2))
|
||||
S = ((M[0]-10),(M[1]-10))
|
||||
E = ((M[0]+10),(M[1]+10)
|
||||
#for i in range(x[0], x[1]):
|
||||
#self.number_of_pixels += 1
|
||||
for j in range(y[0], y[1]):
|
||||
if depth_image[j][i] > self.maxMinDepth:
|
||||
#for j in range(y[0], y[1]):
|
||||
#if depth_image[j][i] > self.maxMinDepth:
|
||||
#depth_values.append(depth_image[j][i])
|
||||
#print(M, S, E)
|
||||
for i in range(S[0], E[0]+1):
|
||||
for j in range(S[1], E[1]+1):
|
||||
print(depth_image[j][i])
|
||||
if depth_image[j][i] > self.maxMinDepth and depth_image[j][i] < 1200:
|
||||
depth_values.append(depth_image[j][i])
|
||||
|
||||
if len(depth_values)>0 and ((max(depth_values) > self.last_depth-100 and max(depth_values) < self.last_depth+100) or self.last_depth == 10):
|
||||
#for i inrange(x[0], x[1]):
|
||||
#if depth_image[y[1]][i] > self.maxMinDepth:
|
||||
#depth_values.append(depth_image[y[0]][i])
|
||||
if len(depth_values)>0 or self.last_depth == 10:
|
||||
self.last_depth = max(depth_values)
|
||||
print(max(depth_values))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user