Skip to content

Commit 54aa191

Browse files
author
tsing
committed
added mathjax support in doc; documented PointCloud and Projector.h
1 parent 9850ba2 commit 54aa191

File tree

6 files changed

+43
-18
lines changed

6 files changed

+43
-18
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ You can use `cmake .. -DENABLE_CUDA=off` to disable CUDA if you don't want compi
2929

3030
### Enable test
3131
A test using [Google Test Framework](https://github.com/google/googletest.git) is included in the build. To use the test, enable `GTEST` flag at configuration stage.
32-
```
32+
```bash
3333
git clone https://github.com/theICTlab/3DUNDERWORLD-SLS-GPU_CPU.git
3434
cd 3DUNDERWORLD-SLS-GPU_CPU
3535
mkdir build
@@ -47,7 +47,7 @@ Document with Doxygen is availabe to be built. Use `-DBUILD_DOC=on` cmake flag t
4747
Code coverage report is provided by using [lcov](http://ltp.sourceforge.net/coverage/lcov.php). In order to get the code coverage report, enable both test and coverage flag: `-DGTEST=on -DCOVERAGE=on` and run `make coverage`. The coverage report will be generated in the `coverage` directory of building path.
4848

4949
### Run demo binary
50-
```
50+
```bash
5151
usage: ./SLS --leftcam=string --rightcam=string --leftconfig=string --rightconfig=string --output=string --format=string --width=unsigned long --height=unsigned long [options] ...
5252
options:
5353
-l, --leftcam Left camera image folder (string)

doc/doxygen.in

+1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ FILE_PATTERNS = *.h \
1515
*.cuh
1616

1717
RECURSIVE = YES
18+
USE_MATHJAX = YES
1819
USE_MDFILE_AS_MAINPAGE = @doxy_main_page@
1920

src/lib/GrayCode/GrayCode.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#include "GrayCode.hpp"
22
namespace SLS{
33
GrayCode::GrayCode(size_t projW, size_t projH):
4-
Projector(projW, projH), currImg(0)
4+
width_(projW), height_(projH),currImg(0)
55
{
6-
setColRowBitsNum();
6+
// Calculate number of bits for each dimension
7+
numColBits = (size_t)std::ceil(std::log2((float) width_));
8+
numRowBits = (size_t)std::ceil(std::log2((float) height_));
79
grayCodes_.resize(numColBits*2+numRowBits*2+2);
810
}
911
void GrayCode::generateGrayCode()
@@ -13,8 +15,6 @@ void GrayCode::generateGrayCode()
1315
mat = cv::Mat(height_, width_, CV_8UC1, cv::Scalar(0));
1416
// Set first frame to white
1517
grayCodes_[0] = cv::Mat(height_, width_, CV_8UC1, cv::Scalar(255));
16-
17-
1818
uchar flag = 0;
1919
for (size_t j=0; j<width_; j++)
2020
{

src/lib/GrayCode/GrayCode.hpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,23 @@
44
#include <cmath>
55

66
namespace SLS{
7-
class GrayCode: public Projector
7+
class GrayCode
88
{
99
public:
10+
//! Construct gray code with size of projector
1011
explicit GrayCode(size_t projW, size_t projH);
11-
~GrayCode() override
12+
~GrayCode()
1213
{
1314
for (auto &img: grayCodes_)
1415
img.release();
1516
}
1617
void generateGrayCode();
1718
private:
19+
//! Projector width and height
20+
size_t width_, height_;
1821
std::vector<cv::Mat> grayCodes_;
1922
size_t currImg;
2023
size_t numColBits, numRowBits;
21-
void setColRowBitsNum()
22-
{
23-
numColBits = (size_t)std::ceil(std::log2((float) width_));
24-
numRowBits = (size_t)std::ceil(std::log2((float) height_));
25-
}
2624
};
2725
} // SLS
2826

src/lib/core/PointCloud.hpp

+13-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,18 @@ namespace SLS
1818
void exportPointCloud2OBJ(std::string fileName, const std::vector<float> &pointCloud);
1919
void exportPointCloud2PLY(std::string fileName, const std::vector<float> &pointCloud);
2020

21+
/*! A point cloud class
22+
*
23+
* The point cloud are stored in raw buffer to faciliate GPU memory access.
24+
* The class can also export point cloud to different file formats
25+
*/
2126
class PointCloud
2227
{
2328
private:
24-
//! Point cloud buffer, stores point cloud in (X,Y,Z,R,G,B)
29+
/*! Point cloud buffer, stores point cloud in (X,Y,Z,R,G,B)
30+
* The point cloud is saved as a raw buffer to faciliate
31+
* furthur processing on GPU.
32+
*/
2533
std::vector<float> buffer_;
2634
const size_t FLOATS_PER_POINT = 6;
2735
public:
@@ -30,7 +38,10 @@ class PointCloud
3038
{
3139
buffer_.resize(numPoints * FLOATS_PER_POINT);
3240
}
33-
//! Get reference of buffer
41+
/*! Get reference of buffer
42+
*
43+
* Use `getBuffer().data()` to access the raw pointer
44+
*/
3445
std::vector<float>& getBuffer()
3546
{
3647
return buffer_;

src/lib/core/Projector.h

+18-3
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,37 @@
2121
#include <cmath>
2222
namespace SLS {
2323

24-
/**
25-
* @brief Patterns that projected to the model
26-
* This class manages projector
24+
/*! Projector projects patterns to reconstruction objects
2725
*/
2826
class Projector
2927
{
3028
protected:
29+
//! Projector width and height
3130
size_t width_, height_;
3231
public:
3332
Projector() = delete;
33+
//! Initialize projector with height and width
3434
Projector(size_t width, size_t height):width_{width},height_{height}{}
3535
virtual ~Projector(){};
36+
/*! Return the size of project
37+
* \param w Output width
38+
* \param h Output height
39+
*/
3640
void getSize(size_t &w, size_t &h){w = width_; h = height_;}
41+
//! Get width
3742
size_t getWidth() const {return width_;}
43+
//! Get height
3844
size_t getHeight() const {return height_;}
45+
//! Get number of pixels = getWidth() * getHeight()
3946
size_t getNumPixels() const {return width_ * height_;}
47+
/*! Get required number of frames to distinguish all of the projector pixel.
48+
*
49+
* The patterns are designed such that each projector pixel has a unique binary sequence.
50+
* One frame can set one bit of the sequences of all projectors. In this application, we
51+
* want to distinguish on both x and y dimensions. Thus, the required number
52+
* of frames can be infered from the size of projector:
53+
* \f[\left\lceil\log_2{w}\right\rceil+\left\lceil\log_2{h}\right\rceil\f]
54+
*/
4055
size_t getRequiredNumFrames() const
4156
{
4257
return (size_t)std::ceil(std::log2(width_))+std::ceil(std::log2(height_));

0 commit comments

Comments
 (0)