projects
/
201903hackathon.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
blur average pixels to eliminate high freq noise in distance data
[201903hackathon.git]
/
cpp
/
sampleOpenCV
/
sampleOpenCV.cpp
diff --git
a/cpp/sampleOpenCV/sampleOpenCV.cpp
b/cpp/sampleOpenCV/sampleOpenCV.cpp
index
cd81a3d
..
d0587a4
100644
(file)
--- a/
cpp/sampleOpenCV/sampleOpenCV.cpp
+++ b/
cpp/sampleOpenCV/sampleOpenCV.cpp
@@
-53,6
+53,7
@@
class MyListener : public IDepthDataListener
public :
public :
+
MyListener() :
undistortImage (false)
{
MyListener() :
undistortImage (false)
{
@@
-116,6
+117,18
@@
public :
undistort (temp, zImage8, cameraMatrix, distortionCoefficients);
}
undistort (temp, zImage8, cameraMatrix, distortionCoefficients);
}
+ if (normblurImage)
+ {
+ auto temp = zImage8.clone();
+ for ( int i = 1; i < MAX_KERNEL_LENGTH; i = i + 2 )
+ {
+ blur( temp, zImage8, Size( i, i ), Point(-1,-1) );
+ }
+ }
+
+
+
+
// scale and display the depth image
scaledZImage.create (Size (data->width * 4, data->height * 4), CV_8UC1);
resize (zImage8, scaledZImage, scaledZImage.size());
// scale and display the depth image
scaledZImage.create (Size (data->width * 4, data->height * 4), CV_8UC1);
resize (zImage8, scaledZImage, scaledZImage.size());
@@
-161,6
+174,12
@@
public :
undistortImage = !undistortImage;
}
undistortImage = !undistortImage;
}
+ void toggleNormBlur()
+ {
+ std::lock_guard<std::mutex> lock (flagMutex);
+ normblurImage = !normblurImage;
+ }
+
private:
// adjust z value to fit fixed scaling, here max dist is 2.5m
private:
// adjust z value to fit fixed scaling, here max dist is 2.5m
@@
-307,6
+326,12
@@
int main (int argc, char *argv[])
// toggle the undistortion of the image
listener.toggleUndistort();
}
// toggle the undistortion of the image
listener.toggleUndistort();
}
+
+ if (currentKey == 'b')
+ {
+ // toggle the undistortion of the image
+ listener.toggleNormBlur();
+ }
}
// stop capture mode
}
// stop capture mode