Skip to content
Snippets Groups Projects
Commit f3b719c4 authored by User expired's avatar User expired :spy_tone1:
Browse files

minor changes to segment_sign

parent 7f79622e
No related branches found
No related tags found
No related merge requests found
sign_detector: sign_detector: {canny_param1: 47, canny_param2: 46, img_height: 1080, img_width: 1920,
canny_param1: 144 max_depth: 1.0, max_radius: 128, min_depth: 0.2, min_radius: 15, visualize: false,
canny_param2: 59 zoom_threshold: 1.15}
img_height: 480
img_width: 640
max_depth: 1.0
max_radius: 128
min_depth: 0.2
min_radius: 15
visualize: false
zoom_threshold: 1.15
# default params that got not overriden # default params that got not overriden
sign_detector: sign_detector:
img_height: 480 img_height: 1080
img_width: 640 img_width: 1920
canny_param1: 100 canny_param1: 100
canny_param2: 100 # good light: 40; bad light: 100 canny_param2: 100 # good light: 40; bad light: 100
min_depth: 0.2 min_depth: 0.2
......
...@@ -14,6 +14,7 @@ from minibot_msgs.srv import segment_sign_command, segment_sign_commandRequest, ...@@ -14,6 +14,7 @@ from minibot_msgs.srv import segment_sign_command, segment_sign_commandRequest,
# *** hyper params *** # *** hyper params ***
#IMG_RES = (480, 640) #IMG_RES = (480, 640)
IMG_RES = (rospy.get_param("sign_detector/img_height", 1080), rospy.get_param("sign_detector/img_width", 1920)) #(1080,1920) IMG_RES = (rospy.get_param("sign_detector/img_height", 1080), rospy.get_param("sign_detector/img_width", 1920)) #(1080,1920)
DEPTH_RES = (480, 640)
TENSOR_RES = (224, 224) TENSOR_RES = (224, 224)
# gazebo 70,30; rviz 70, 20; real 100 40 # gazebo 70,30; rviz 70, 20; real 100 40
canny = rospy.get_param("sign_detector/canny_param1", 100) #100 canny = rospy.get_param("sign_detector/canny_param1", 100) #100
...@@ -68,7 +69,7 @@ def circular_mean(p, r, arr : np.array): ...@@ -68,7 +69,7 @@ def circular_mean(p, r, arr : np.array):
sum_px_values = 0 sum_px_values = 0
count_px = 0 count_px = 0
for x, y in xy: for x, y in xy:
if x >= IMG_RES[1] or y >= IMG_RES[0]: if x >= DEPTH_RES[1] or y >= DEPTH_RES[0]:
continue continue
if (x - p[0])**2 + (y - p[1])**2 < r**2: if (x - p[0])**2 + (y - p[1])**2 < r**2:
sum_px_values += arr[y, x] sum_px_values += arr[y, x]
......
...@@ -93,7 +93,7 @@ def do_shape_detection(img_rgb, img_depth): ...@@ -93,7 +93,7 @@ def do_shape_detection(img_rgb, img_depth):
if VISUALIZE: if VISUALIZE:
cv2.imshow('thresh img', thresh1) cv2.imshow('thresh img', thresh1)
contours, hierarchy = cv2.findContours(thresh1, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) contours, hierarchy = cv2.findContours(thresh1, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)[-2:]
keypoints = [] keypoints = []
for cnt in contours: for cnt in contours:
approx = cv2.approxPolyDP(cnt,0.01*cv2.arcLength(cnt,True),True) approx = cv2.approxPolyDP(cnt,0.01*cv2.arcLength(cnt,True),True)
...@@ -142,4 +142,4 @@ if __name__=="__main__": ...@@ -142,4 +142,4 @@ if __name__=="__main__":
#cv2.imshow("Shape", img_processed) #cv2.imshow("Shape", img_processed)
rate.sleep() rate.sleep()
\ No newline at end of file
<?xml version="1.0"?> <?xml version="1.0"?>
<launch> <launch>
<include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch" >
<arg name="port" value="9090"/>
</include>
<include file="$(find minibot)/launch/bringup_minibot.launch" >
<arg name="run_arm" value="false" />
</include>
<include file="$(find minibot_vision)/launch/capture_imgs.launch" > <include file="$(find minibot_vision)/launch/capture_imgs.launch" >
<arg name="remote_node" value="true" /> <arg name="remote_node" value="true" />
</include> </include>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment