ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Inconsistency of `read_points` and opencv coordinates?

asked 2022-08-26 18:26:31 -0500

iHany gravatar image

updated 2022-08-29 11:56:02 -0500

Hi, I'm trying to get lines from an image and get the corresponding points from a point cloud.

Note that I ran Realsense camera D455 and ran a launch file that converts color and depth images to a point cloud, based on [point_cloud_xyzrgb, depth_image_proc].

For now, I detected lines from a color image as described here. Note that I artifically chose only one line for the test (lines = [lines[-1]]). Then, read the corresponding points from the ponit cloud like this using point_cloud2.read_points. Note that I can choose specific points by giving the argument uvs.

I thought uvs is an iterator of (u, v) where u and v corresponds to uv coordinate systems in opencv. That is, u is right, v is down.

But the result looks like it is flipped.

Here are intermediate results:

  • lines[0]

array([411.38839626, 186.68757629, 442.08746529, 539.14202881])

(each line = [x1, y1, x2, y2])

  • line_iterators[0], that is, points along with each line on the color image:

(Pdb) p line_iterators[0]

[[411, 187], [411, 188], [411, 189], [411, 190], [411, 191], [411, 192], [411, 193], [411, 194], [411, 195], [411, 196], [411, 197], [412, 198], [412, 199], [412, 200], [412, 201], [412, 202], [412, 203], [412, 204], [412, 205], [412, 206], [412, 207], [412, 208], [413, 209], [413, 210], [413, 211], [413, 212], [413, 213], [413, 214], [413, 215], [413, 216], [413, 217], [413, 218], [413, 219], [413, 220], [414, 221], [414, 222], [414, 223], [414, 224], [414, 225], [414, 226], [414, 227], [414, 228], [414, 229], [414, 230], [414, 231], [415, 232], [415, 233], [415, 234], [415, 235], [415, 236], [415, 237], [415, 238], [415, 239], [415, 240], [415, 241], [415, 242], [416, 243], [416, 244], [416, 245], [416, 246], [416, 247], [416, 248], [416, 249], [416, 250], [416, 251], [416, 252], [416, 253], [416, 254], [417, 255], [417, 256], [417, 257], [417, 258], [417, 259], [417, 260], [417, 261], [417, 262], [417, 263], [417, 264], [417, 265], [418, 266], [418, 267], [418, 268], [418, 269], [418, 270], [418, 271], [418, 272], [418, 273], [418, 274], [418, 275], [418, 276], [418, 277], [419, 278], [419, 279], [419, 280], [419, 281], [419, 282], [419, 283], [419, 284], [419, 285], [419, 286], [419, 287], [419, 288], [420, 289], [420, 290], [420, 291], [420, 292], [420, 293], [420, 294], [420, 295], [420, 296], [420, 297], [420, 298], [420, 299], [421, 300], [421, 301], [421, 302], [421, 303], [421, 304], [421, 305], [421, 306], [421, 307], [421, 308], [421, 309], [421, 310], [421, 311], [422, 312], [422, 313], [422, 314], [422, 315], [422, 316], [422, 317], [422, 318], [422, 319], [422, 320], [422, 321], [422, 322], [423, 323], [423, 324], [423, 325], [423, 326], [423, 327], [423, 328], [423, 329], [423, 330], [423, 331], [423, 332], [423, 333], [423, 334], [424, 335], [424, 336], [424, 337], [424, 338], [424, 339], [424, 340], [424, 341], [424, 342], [424, 343], [424, 344], [424, 345], [425, 346], [425, 347], [425, 348], [425, 349], [425, 350], [425 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-08-27 12:02:18 -0500

Mike Scheutzow gravatar image

updated 2022-08-27 12:04:16 -0500

What coordinate does uvs follow in read_points?

The uvs argument is a list of (x,y) coordinates. "Iterable" is referring to the fact that uvs is a list. The coordinate system is that of the full PointCloud2. For the 2-D arrangement of Points, the message definition does not specify whether the rows are ordered top-to-bottom or bottom-to-top. In my experience, the origin is in upper left, with y incrementing as you move down the rows.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-08-26 18:26:31 -0500

Seen: 51 times

Last updated: Aug 29 '22