mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 17:40:23 +08:00
OpenNI2: depth shift can be negative. MainWindow: postProcessing() refactoring (split with and without dialog).
This commit is contained in:
@@ -178,8 +178,6 @@ void CameraOpenNI2::setOpenNI2StampsAndIDsUsed(bool used)
|
||||
void CameraOpenNI2::setIRDepthShift(int horizontal, int vertical)
|
||||
{
|
||||
#ifdef RTABMAP_OPENNI2
|
||||
UASSERT(horizontal >= 0);
|
||||
UASSERT(vertical >= 0);
|
||||
_depthHShift = horizontal;
|
||||
_depthVShift = vertical;
|
||||
#endif
|
||||
@@ -538,10 +536,19 @@ SensorData CameraOpenNI2::captureImage(CameraInfo * info)
|
||||
|
||||
if(_type==kTypeColorDepth)
|
||||
{
|
||||
if (_depthHShift > 0 || _depthVShift > 0)
|
||||
if (_depthHShift != 0 || _depthVShift != 0)
|
||||
{
|
||||
cv::Mat out = cv::Mat::zeros(depth.size(), depth.type());
|
||||
depth(cv::Rect(_depthHShift, _depthVShift, depth.cols - _depthHShift, depth.rows - _depthVShift)).copyTo(out(cv::Rect(0, 0, depth.cols - _depthHShift, depth.rows - _depthVShift)));
|
||||
depth(cv::Rect(
|
||||
_depthHShift>0?_depthHShift:0,
|
||||
_depthVShift>0?_depthVShift:0,
|
||||
depth.cols - abs(_depthHShift),
|
||||
depth.rows - abs(_depthVShift))).copyTo(
|
||||
out(cv::Rect(
|
||||
_depthHShift<0?-_depthHShift:0,
|
||||
_depthVShift<0?-_depthVShift:0,
|
||||
depth.cols - abs(_depthHShift),
|
||||
depth.rows - abs(_depthVShift))));
|
||||
depth = out;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user