Skip to content

Commit bbb2297

Browse files
problem with depth extraction
1 parent 5fa76ff commit bbb2297

File tree

5 files changed

+77
-28
lines changed

5 files changed

+77
-28
lines changed

config/eod_example.rviz

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ Visualization Manager:
5555
Frame Timeout: 15
5656
Frames:
5757
All Enabled: true
58-
dai_rgb_camera_optical_frame:
59-
Value: true
6058
map:
6159
Value: true
6260
oak-d-base-frame:
@@ -87,8 +85,22 @@ Visualization Manager:
8785
Show Names: true
8886
Tree:
8987
map:
90-
dai_rgb_camera_optical_frame:
88+
oak_rgb_camera_optical_frame:
9189
{}
90+
oak-d-base-frame:
91+
oak-d_frame:
92+
oak_imu_frame:
93+
{}
94+
oak_left_camera_frame:
95+
oak_left_camera_optical_frame:
96+
{}
97+
oak_model_origin:
98+
{}
99+
oak_rgb_camera_frame:
100+
{}
101+
oak_right_camera_frame:
102+
oak_right_camera_optical_frame:
103+
{}
92104
Update Interval: 0
93105
Value: true
94106
- Alpha: 1
@@ -124,8 +136,7 @@ Visualization Manager:
124136
Marker Topic: /extended_object_detection/simple_objects_markers
125137
Name: SimpleObjects
126138
Namespaces:
127-
CnnPerson_arrow: true
128-
CnnPerson_frame: true
139+
{}
129140
Queue Size: 100
130141
Value: true
131142
- Class: rviz/MarkerArray
@@ -150,7 +161,7 @@ Visualization Manager:
150161
Value: true
151162
- Class: rviz/Image
152163
Enabled: true
153-
Image Topic: /rgb_stereo_publisher/stereo/depth
164+
Image Topic: /oak/stereo/depth
154165
Max Value: 1
155166
Median window: 5
156167
Min Value: 0
@@ -160,11 +171,39 @@ Visualization Manager:
160171
Transport Hint: raw
161172
Unreliable: false
162173
Value: true
174+
- Alpha: 1
175+
Autocompute Intensity Bounds: true
176+
Autocompute Value Bounds:
177+
Max Value: 10
178+
Min Value: -10
179+
Value: true
180+
Axis: Z
181+
Channel Name: intensity
182+
Class: rviz/PointCloud2
183+
Color: 255; 255; 255
184+
Color Transformer: Intensity
185+
Decay Time: 0
186+
Enabled: true
187+
Invert Rainbow: false
188+
Max Color: 255; 255; 255
189+
Min Color: 0; 0; 0
190+
Name: PointCloud2
191+
Position Transformer: XYZ
192+
Queue Size: 10
193+
Selectable: true
194+
Size (Pixels): 3
195+
Size (m): 0.009999999776482582
196+
Style: Flat Squares
197+
Topic: /oak/stereo/points/mono
198+
Unreliable: false
199+
Use Fixed Frame: true
200+
Use rainbow: true
201+
Value: true
163202
Enabled: true
164203
Global Options:
165204
Background Color: 48; 48; 48
166205
Default Light: true
167-
Fixed Frame: map
206+
Fixed Frame: oak-d-base-frame
168207
Frame Rate: 30
169208
Name: root
170209
Tools:
@@ -188,25 +227,25 @@ Visualization Manager:
188227
Views:
189228
Current:
190229
Class: rviz/Orbit
191-
Distance: 3.9028306007385254
230+
Distance: 8.260529518127441
192231
Enable Stereo Rendering:
193232
Stereo Eye Separation: 0.05999999865889549
194233
Stereo Focal Distance: 1
195234
Swap Stereo Eyes: false
196235
Value: false
197236
Field of View: 0.7853981852531433
198237
Focal Point:
199-
X: 1.1988993883132935
200-
Y: -0.6332588195800781
201-
Z: -0.4015747904777527
238+
X: 1.152783751487732
239+
Y: -0.16227556765079498
240+
Z: -0.4943612217903137
202241
Focal Shape Fixed Size: true
203242
Focal Shape Size: 0.05000000074505806
204243
Invert Z Axis: false
205244
Name: Current View
206245
Near Clip Distance: 0.009999999776482582
207-
Pitch: 0.4397958815097809
246+
Pitch: 0.44979575276374817
208247
Target Frame: <Fixed Frame>
209-
Yaw: 2.4104363918304443
248+
Yaw: 2.40043306350708
210249
Saved: ~
211250
Window Geometry:
212251
DepthImage:

config/object_base_example/ObjectBaseExample.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@
8484

8585
<Attribute Name="DepthKinect" Type="Depth" depthScale="0.001"/>
8686

87+
<Attribute Name="DepthCenter" Type="Depth" depthScale="0.001" mode="2"/>
88+
8789
<Attribute Name="DlibFace" Type="FaceDlib" Probability="0.4" base_file_path="face_recognition/base_faces.db" base_dir_path="face_recognition/base_faces/" sp_path="face_recognition/shape_predictor_5_face_landmarks.dat" net_path="face_recognition/dlib_face_recognition_resnet_model_v1.dat"/>
8890

8991
<Attribute Name="ID13" Type="ExtractedInfoID" field="Aruco4:marker_id" allowed="13" forbidden=""/>
@@ -100,6 +102,8 @@
100102

101103
<Attribute Name="COCO_static" Type="LogicNot" A="COCO_dynamic"/>
102104

105+
<Attribute Name="UnitTranslation" Type="UnitTranslation"/>
106+
103107
</AttributeLib>
104108

105109
<SimpleObjectBase>
@@ -254,8 +258,9 @@
254258

255259
<SimpleObject Name="CnnPerson" ID="67">
256260
<Attribute Type="Detect">COCO_Dnn</Attribute>
257-
<Attribute Type="Check">COCO_person</Attribute>
258-
<Attribute Type="Extract" Channel="DEPTH">DepthKinect</Attribute>
261+
<Attribute Type="Check">COCO_person</Attribute>
262+
<Attribute Type="Extract">UnitTranslation</Attribute>
263+
<Attribute Type="Extract" Channel="DEPTH">DepthCenter</Attribute>
259264

260265
</SimpleObject>
261266

launch/extended_object_detection_oakd_example.launch

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
<arg name="output" default="screen"/>
33
<arg name="objectBasePath" default="$(find extended_object_detection)/config/object_base_example/ObjectBaseExample.xml"/>
44

5-
<include file="$(find depthai_examples)/launch/rgb_stereo_node.launch">
5+
<!--<include file="$(find depthai_examples)/launch/rgb_stereo_node.launch">
66
7+
</include>-->
8+
9+
<include file="$(find ritrover-oakd)/launch/rgb_stereo_publisher.launch">
10+
<arg name="point_cloud_mono" value="true"/>
11+
<arg name="urdf" value="true"/>
712
</include>
813

914
<node name="extended_object_detection" pkg="extended_object_detection" type="extended_object_detection_node" output="screen" >
@@ -16,10 +21,10 @@
1621
<param name="publish_markers" value="true"/>
1722

1823

19-
<remap from="camera/image_raw" to="/rgb_stereo_publisher/color/image"/>
20-
<remap from="camera/info" to="/rgb_stereo_publisher/color/camera_info"/>
21-
<remap from="depth/image_raw" to="/rgb_stereo_publisher/stereo/depth"/>
22-
<remap from="depth/info" to="/rgb_stereo_publisher/stereo/camera_info"/>
24+
<remap from="camera/image_raw" to="/oak/rgb/image"/>
25+
<remap from="camera/info" to="/oak/rgb/camera_info"/>
26+
<remap from="depth/image_raw" to="/oak/stereo/depth"/>
27+
<remap from="depth/info" to="/oak/stereo/camera_info"/>
2328

2429
<rosparam param="selected_on_start_simple_objects">[67]</rosparam>
2530
<rosparam param="selected_on_start_complex_objects">[-1]</rosparam>
@@ -30,7 +35,7 @@
3035
<node pkg="rviz" type="rviz" name="rviz"
3136
args="-d $(find extended_object_detection)/config/eod_example.rviz --opengl 300" />
3237

33-
<node pkg="tf" type="static_transform_publisher" name="static_cam_pub"
34-
args="0 0 0 -1.57 0 -1.57 map dai_rgb_camera_optical_frame 100"/>
38+
<!--<node pkg="tf" type="static_transform_publisher" name="static_cam_pub"
39+
args="0 0 0 -1.57 0 -1.57 map oak_rgb_camera_optical_frame 100"/> -->
3540

3641
</launch>

src/extended_object_detection_node/eod_node.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ cv::Mat EOD_ROS::getD(const sensor_msgs::CameraInfoConstPtr& info_msg){
126126
}
127127

128128
void EOD_ROS::rgb_info_cb(const sensor_msgs::ImageConstPtr& rgb_image, const sensor_msgs::CameraInfoConstPtr& rgb_info){
129-
ROS_INFO("Get Image!");
130-
129+
//ROS_INFO("Got Image!");
131130
// CHECK RATE
132131
if( !check_time(ros::Time::now()) ) {
133132
ROS_WARN("Skipped frame");
@@ -149,8 +148,7 @@ void EOD_ROS::rgb_info_cb(const sensor_msgs::ImageConstPtr& rgb_image, const sen
149148
}
150149

151150
void EOD_ROS::rgbd_info_cb(const sensor_msgs::ImageConstPtr& rgb_image, const sensor_msgs::CameraInfoConstPtr& rgb_info, const sensor_msgs::ImageConstPtr& depth_image, const sensor_msgs::CameraInfoConstPtr& depth_info){
152-
ROS_INFO("Got RGBD!");
153-
151+
//ROS_INFO("Got RGBD!");
154152
// CHECK RATE
155153
if( !check_time(ros::Time::now()) ) {
156154
ROS_WARN("Skipped frame");
@@ -169,9 +167,11 @@ void EOD_ROS::rgbd_info_cb(const sensor_msgs::ImageConstPtr& rgb_image, const se
169167

170168
cv::Mat depth;
171169
if (depth_image->encoding == sensor_msgs::image_encodings::TYPE_16UC1){
172-
depth = cv_bridge::toCvCopy(depth_image, sensor_msgs::image_encodings::TYPE_16UC1)->image;
170+
ROS_INFO("Depth encoding is 16uc1");
171+
depth = cv_bridge::toCvCopy(depth_image, sensor_msgs::image_encodings::TYPE_16UC1)->image * 0.001f;
173172
}
174173
else if(depth_image->encoding == sensor_msgs::image_encodings::TYPE_32FC1){
174+
ROS_INFO("Depth encoding is 32fc1");
175175
depth = cv_bridge::toCvCopy(depth_image, sensor_msgs::image_encodings::TYPE_32FC1)->image;
176176
}
177177
else{

0 commit comments

Comments
 (0)