MCPcopy Create free account
hub / github.com/andybarry/makerscanner / Entry

Method Entry

ScanThread.cpp:124–207  ·  view source on GitHub ↗

Called when thread is started

Source from the content-addressed store, hash-verified

122
123// Called when thread is started
124void* ScanThread::Entry()
125{
126 captureThread->SetCapture(CAPTURE);
127
128 // set up a pointcloud object
129 pointCloud = new PointCloud();
130
131 vector<float> *laserPos;
132
133 IplImage *withLaser;
134
135 // determine a distance from reference
136 // we might have a distance from reference from the user, or the laser
137 // has been centered
138 if (distanceFromFlatReference <= 0)
139 {
140 // we need to compute the distance to the reference wall.
141 // we can use the laserCentered image to do this.
142
143 // first, find the laser in the laserCentered image
144 laserPos = FindLaser2(laserCentered);
145
146 // with that data, compute the distance to the wall
147 // NOTE: this function also sets pixelsPerCmOnFlatReference which is required for operation
148 distanceFromFlatReference = GetDistanceToReferenceWall(laserPos);
149
150 if (distanceFromFlatReference < 0)
151 {
152 captureThread->SetCapture(PREVIEW);
153
154 SendScanFinishedEvent();
155
156 return NULL;
157 }
158
159 // free memory for the laser-centered laser position vector
160 delete laserPos;
161 } else
162 {
163 pixelsPerCmOnFlatReference = PIXELS_PER_CM_PER_CM / distanceFromFlatReference;
164 }
165
166 while (scanStatus->GetScanning() == true)
167 {
168 // check to see if the thread should exit
169 if (TestDestroy() == true) break;
170
171 // get an image from the capture thread
172
173 withLaser = captureThread->Pop();
174
175 if (withLaser)
176 {
177
178 // find the laser beam in the image
179 laserPos = FindLaser2(withLaser);
180
181 // display the laser position for the user

Callers

nothing calls this directly

Calls 3

SetCaptureMethod · 0.80
GetScanningMethod · 0.80
PopMethod · 0.80

Tested by

no test coverage detected