forked from josephdanielchang/IntelRealSense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVisual Studio 2019 C++ Notes.txt
225 lines (177 loc) · 7.84 KB
/
Visual Studio 2019 C++ Notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
------------------------- SOFTWARE -------------------------
V 2 camera RGB/depth stream
V Map depth to color
V Sync between 2 pairs
V Cancel initial exposure
V Save RGB/depth frames as PNG
V Stream at stable fps (currently 640x480)
V Allow user to set fps, resolution
V Check single camera rgb/depth sync timestamp difference
V Raw bits, binary output
V Output timestamp to text file
V Intrinsic parameters of 4 cameras (checkboard, matlab)
V FPS for streaming (6, 15, 30, 60)
V Check FPS after all processing
V Save pointcloud
V Master-Slave sync, disable auto RS2_OPTION_DISABLE_AUTO_EXPOSURE
V Fix timestamp duplicates and skips
V Make sure index starts at 1
V Ensure left and right cameras synchronized
Use software-device to unack .bin files
Write new save_raw_data to save matrix with Matlab save
=====================================================================
========================= COMPLETE TUTORIAL =========================
=====================================================================
------------------------- Download SDK Examples -------------------------
Get laptop
Download Visual Studio C++
Go to https://github.com/IntelRealSense/librealsense/releases
Go to Assets
Download latest Intel.RealSense.SDK-WIN10-2.24.0939.exe
Go to Local Disk (C:) -> Program Files (x86) -> IntelRealSense SDK 2.0
Open examples by clicking on ar-basic.vcxproj
Replace ar-basic.cpp code with own code
Right click project >> Set as Startup Project
------------------------- Install OpenCV with VCPKG -------------------------
Go to https://docs.microsoft.com/en-us/cpp/build/vcpkg?view=vs-2019
Download to C:/Program Files
Open cmd window as admin
Type: cd C:/Program Files/vcpkg-master
Type: bootstrap-vcpkg.bat
Type: vcpkg search opencv
If machine x64 not x86, type: set VCPKG_DEFAULT_TRIPLET=x64-window
Type: vcpkg install opencv
Type: vcpkg list
Type: vcpkg integrate install (integrates vcpkg with Visual Studio)
------------------------- Run realsense_metadata_win10 script -------------------------
https://github.com/IntelRealSense/librealsense/blob/master/doc/installation_windows.md
https://github.com/IntelRealSense/librealsense/blob/master/scripts/realsense_metadata_win10.ps1
------------------------- Add OpenCV to Visual Studio -------------------------
Project >> align-save properties >> C/C++ >> General >> Additional Include Directories
Add C:\Program Files\vcpkg-master\installed\x64-windows\include;
------------------------- Hardware -------------------------
Attach camera sync cable https://www.mouser.com/pdfdocs/Multiple_Camera_WhitePaper_rev11.pdf
Plug left camera to left USB and right camera to right USB
Build code
Run Local Windows Debugger to start recording and streaming
Press stop debugging to stop recording and streaming
=====================================================================
=====================================================================
=====================================================================
------------------------- CMAKE -------------------------
Tutorial to build projects
https://www.youtube.com/watch?v=LxHV-KNEG3k
------------------------- MEX -------------------------
Merge C++ with Matlab rectification
------------------------- Record with Intel Viewer -------------------------
Add sources >> Turn on stereo and rgb >> Set to 640x480 and 30fps
Stereo >> Control >> Turn on intercamera sync >> Set cameras to mode 1 and 2 >> Record
Color >> Control >> Turn off Auto Exposure Priority
------------------------- LINKS -------------------------
Libraries https://github.com/IntelRealSense/librealsense
Examples https://github.com/IntelRealSense/librealsense/tree/master/examples
SDK https://github.com/IntelRealSense/librealsense/releases
API Documentation https://intelrealsense.github.io/librealsense/doxygen/annotated.html
SDK Install https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_windows.md
SDK Install https://github.com/IntelRealSense/librealsense/releases/tag/v2.23.0
API How to https://github.com/IntelRealSense/librealsense/wiki/API-How-To
Visual Studio C++ Walkthrough https://docs.microsoft.com/en-us/cpp/ide/walkthrough-testing-a-project-cpp?view=vs-2019
PCL https://github.com/IntelRealSense/librealsense/blob/master/wrappers/pcl/pcl/rs-pcl.cpp
PCL Setup https://writingovercoffeeblog.wordpress.com/2017/06/11/setup-pcl-on-visual-studio-2015-the-no-fuss-way/
Save raw data https://github.com/IntelRealSense/librealsense/issues/1485
------------------------- SDK Examples Used -------------------------
rs-multicam.cpp
rs-align.cpp
rs-save-to-disk.cpp
------------------------- VARIABLES -------------------------
fs rs2::frameset
new_frames size 2
------------------------- VISUAL STUDIO 2019 C++ -------------------------
Build project --> Add source and header files
Add files by right clicking under project and adding, not Ctrl+N
Compile : convert high level code to machine level code
Build : convert high level language to an executable (compiling and linking)
Build Solution : builds everything
Build hello-world : builds single project
Compile : builds single file
Change start-up project --> right click another project and click Set as Startup Project
Add path to headers with:
Project >> align-save properties >> C/C++ >> General >> Additional Include Directories
------------------------- C++ Notes -------------------------
------------------------- Struct -------------------------
struct Food{
int Weight;
float Price;
};
int main(){
Food Apple;
Food pear;
Apple.Weight = 90;
Apple.Price = 9.99;
Pear.Weight = 80;
Pear.Price = 99.99;
cout << "Apple weight: " << Apple.Weight << endl << "Apple price: " << Apple.Price << endl << endl;
cout << "Pear weight: " << Pear.Weight << endl << "Pear price: " << Pear.Price << endl << endl;
------------------------- push_back, emplace_back -------------------------
list.push_back(40); adds 40 to end of vector list
list.emplace_back(40); adds 40 to end of vector list
list.pop_back(); removes last item off vector
------------------------- References -------------------------
int x = 10; ref and x are same variable
int& ref = x;
// References can modify the passed parameters in a function
void swap (int& first, int& second)
{
int temp = first;
first = second;
second = temp;
}
int main()
{
int a = 2, b = 3;
swap (a, b);
cout << a << " " << b;
return 0;
}
// Avoiding copy of large structures
struct Student {
string name;
string address;
int rollNo;
}
// Without &, new copy of student object is created
void print(const Student &s)
{
cout << s.name << " " << s.address << " " << s.rollNo;
}
// For Each Loops to modify all objects
int main()
{
vector<int> vect{ 10, 20, 30, 40 };
for (int &x : vect)
x = x + 5;
for (int x : vect)
cout << x << " ";
return 0;
}
// Avoid copy of whole object
int main()
{
vector<string> vect{"geeksforgeeks practice",
"geeksforgeeks write",
"geeksforgeeks ide"};
for (const auto &x : vect)
cout << x << endl;
return 0;
}
References cannot be reseated like pointers
References cannot be NULL like pointers
References must be initialized when declared unlike pointers
auto => will copy the element, but a reference is more efficient
auto& => will only bind to modifiable lvalues
const auto& => will bind to anything but make it const, giving us const_iterator
const auto&& => will bind to rvalues
------------------------- sprintf -------------------------
Used to concatenate strings
------------------------- (void*) -------------------------
General pointer that can point to anything