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

Class ScanThread

ScanThread.h:62–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60// Thread that performs image capture and point cloud creation
61// Uses events to communicate with GUI thread for frame and disk interactions
62class ScanThread : public wxThread
63{
64 public:
65 // Constructor
66 ScanThread(wxFrame *windowIn, CaptureThread *captureIn, ScanStatus *scanStatusIn, IplImage *noLaserIn,
67 IplImage *laserCenteredIn, float distanceToReferenceIn);
68
69 // Function that is run on thread init
70 virtual void* Entry();
71
72 // TODO: Remove
73 void SetPixelRange(int Xmin = 0, int Ymin = 0, int Xmax = MAX_X, int Ymax = MAX_Y);
74
75 // set image subtraction threshold value
76 void SetThresholdPixelValue(int thres) { minPxVal = thres; }
77
78 float FindReferenceLaser(IplImage *img);
79
80 void SetBrightnessThreshold(float newThreshold) { brightnessThreshold = newThreshold; }
81
82 private:
83
84 // Find the laser by subtracting noLaser (class variable) and withLaser images
85 // the compute distances and add to the pointcloud object
86 vector<float>* FindLaser2(IplImage *withLaser);
87
88 // send an UpdateImage event to the frame dialog
89 //void DisplayImage(IplImage *frame);
90
91 // send a display text event to the frame
92 void DisplayText(wxString text);
93
94 // send a write to file event to the frame
95 void WriteToFile(wxString str);
96
97 // write the current pointcloud to a file
98 void WritePointCloudFile();
99
100 // compute distance to pixel based on width reference pixel position and the laser pixel position
101 double PixelToDistance2(float laserCenter, float widthReference);
102
103 // Add a point to the pointcloud, with some filtering
104 void AddPointCloudPoint(PointCloudPoint *newPoint, BwImage laserHitPx, BwImage laserFilterPx);
105
106 // point cloud points for storing filtering
107 PointCloudPoint *holdingPointBefore;
108 PointCloudPoint *holdingPoint;
109
110 // Send a scan progress event to update the frame progress bar
111 void SendScanProgress(int laserPos);
112
113 // Send a scan finished event to the frame
114 void SendScanFinishedEvent();
115
116 // Safely close
117 void OnExit();
118
119 void AddPointcloudPoints(vector<float> *laserPos);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected