Repository: opencv
Issue: Point cloud compression for 3d module
Labels: feature,GSoC,category: 3d module

### Description

The purpose of this issue is to provide a plan outline for the [`OpenCV GSoC_2023 Ideas4(Point Cloud Compression)`](https://github.com/opencv/opencv/wiki/GSoC_2023#idea-point-cloud-compression). This outline will guide the development of our entire project in order to regulate the development process. Any suggestions will be appreciated!

The project is about implementing a point cloud compression algorithm based on the octree. The 3d module in branch 5.x has implemented octree and basic point cloud I/O functions. However, the current octree lacks attributes and functions to realize compression. 

A new class will be created in 3d module of branch 5.x to implement all related compression algorithms.





### PR Schedule:

Pull requests is planned to be submitted based on the following outline(all PR need code reviews, unit test and documentation):

- [x] Refactor relevant code in 3d module:

  * Modify the original ply reader & writer to support extra information, eg. uchar color #23805
  * Build a new class for octree compression with user interfaces (referring to PCL, Draco...)

- [ ] Implement basic octree compression ([Reference: Octree-based Point-Cloud Compression](http://diglib.eg.org/bitstream/handle/10.2312/SPBG.SPBG06.111-120/111-120.pdf?sequence=1&isAllowed=y))

  * Implement transformation between vector-based point clouds and octree-based point clouds 
  * Implement entropy encoding & decoding
  * Implement basic octree compression based on octree

- [ ] Implement compression of color attribute ([Reference: Compression of 3D Point Clouds Using a Region-Adaptive Hierarchical Transform](https://ieeexplore.ieee.org/document/7482691))
  * Implement color attribute encoding & decoding based on RAHT
  * Complete the compression algorithm based on the mentioned algorithms, then apply tests

- [ ] Further enhancements on compression rate ([Reference: G-PCC Codec Description](https://mpeg-pcc.org/wp-content/uploads/2021/09/N00151_G-PCC_codec_description_v12_d0.docx))
  * Provide optimization options for advanced compression techniques
  * Implement Direct Coding Mode(DCM)
  * Implement Prediction Coding Mode(PDM)

- [ ] Support for dynamic point clouds based on previous efficient algorithms ([Reference: Real-time Compression of Point Cloud Streams](https://ieeexplore.ieee.org/document/6224647))
  * Implement inter-frame coding
  * Implement key frame algorithm
  * Implement effective compression of real-time dynamic point cloud, streaming transmission and variable rate decompression

- [ ] Optimization and formatting
  * Apply methods of optimizations
  * Construct tests, measure performance in correctness, time cost, reconstruction quality, etc
  * Provide user logs, including compression information and performance indicators
  * Ensure compatibility under prevailing platforms
  * Code reviews, format the code to OpenCV style



### Other References:

* H. Liu, H. Yuan, Q. Liu, J. Hou and J. Liu, "[A Comprehensive Study and Comparison of Core Technologies for MPEG 3-D Point Cloud Compression](https://ieeexplore.ieee.org/document/8945224)," in IEEE Transactions on Broadcasting, vol. 66, no. 3, pp. 701-717, Sept. 2020, doi: 10.1109/TBC.2019.2957652.

* Y. Huang, J. Peng, C. . -C. J. Kuo and M. Gopi, "[A Generic Scheme for Progressive Point Cloud Coding](https://ieeexplore.ieee.org/document/4378368)," in IEEE Transactions on Visualization and Computer Graphics, vol. 14, no. 2, pp. 440-453, March-April 2008, doi: 10.1109/TVCG.2007.70441.

* Cao, Chao & Preda, Marius & Zaharia, Titus. (2019). [3D Point Cloud Compression: A Survey](https://www.researchgate.net/publication/334619682_3D_Point_Cloud_Compression_A_Survey). 1-9. 10.1145/3329714.3338130.