PCL point cloud data operations opencv traversal data

Source: Internet
Author: User

1. for a cloud instance of the point cloud type, assign a value to the point I of the instance, and use cloud. point [I]. X and cloud. point [I]. Y and cloud. point [I]. Z assigns values to their XYZ coordinates respectively.

Cloud. Point [I]. x =

Cloud. Point [I]. Y =

Cloud. Point [I]. z =

2. opencv traverses the matrix m and uses the row pointer M. PTR <datatype> (ROW) to point to the row.

<Datatype> * Data = M. PTR <datatype> (ROW)

3. opencv takes the M element of the given index matrix, M. at <datatype> (I, j), indicating to take the elements of row I and column J.

A = M. at <datatype> (I, j)

 

The following is a routine:

1 // use depth data to reconstruct 3D point clouds 2 int ROW = 0, Col = 0, pointid = 0; 3 for (ROW = 0; row <depthheight; row ++) // ROW = y traverse all rows in the depth Matrix 4 {5 unsigned short * Data = depthdata. PTR <unsigned short> (ROW); 6 for (COL = 0; Col <depthwidth; Col ++) // Col = x traverse all columns of the Depth Matrix 7 {8 If (* Data> 500 & * Data <1500) // obtain the depth data in the range of m-m 9 {10 pointid ++; 11 // [x, y, z] '= depth [x, y] * inv_k * [x, y, 1] 12 cloud. points [pointid]. X = * Data * (COL * minvk. at <float> (0, 0) + 13 row * minvk. at <float> (0, 1) + minvk. at <float> (0, 2); // x14 15 cloud. points [pointid]. y = * Data * (COL * minvk. at <float> (1, 0) + 16 row * minvk. at <float> (1, 1) + minvk. at <float> (1, 2); // Y17 18 cloud. points [pointid]. z = * data; // z19} 20 else // data in other ranges has no operation 21 {22} 23 data ++; // depth Data Pointer, pointing to the next position, deep data 24} 25}

 

PCL point cloud data operations opencv traversal data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.