Items with no label
3335 Discussions

mapColorToDepth return (-1, -1) in depth map coordinate

LLin40
Beginner
1,068 Views

Hello All,

I tried to map points from a valid color coordinate to depth coordinate.

However, if the color coordinate set over (2, 2), mapColorToDepth will return (-1, -1) in depth map coordinate.

Actually the depth image dimension in my code is 480x360, and the dimension of color image is 320x240.

I even tried to set color coordinate (160, 120), and the function still returned (-1, -1).

Code :

public void getAlignedDepthImage(Bitmap mRGBBitmap, Bitmap mDepthBitmap) {

// mRGBBitmap : 320*240; mDepthBitmap : 480*360

Log.d(TAG, String.format("mDepthBitmap size = %d", mDepthBitmap.getByteCount()));

 

mRGBBitmap.copyPixelsToBuffer(rgbImage.getPlanes()[0].getBuffer());

 

mDepthBitmap.copyPixelsToBuffer(depthImage.getPlanes()[0].getBuffer());

 

 

Log.d(TAG, String.format("depthImage size = %d", depthImage.getPlanes()[0].getBuffer().capacity()));

 

try {

 

PointF[] mPoint = new PointF[4];

 

mPoint[0] = new PointF(0.0f, 0.0f);

 

mPoint[1] = new PointF(1.0f, 1.0f);

 

mPoint[2] = new PointF(2.0f, 2.0f);

 

mPoint[3] = new PointF(160.0f, 120.0f);

 

PointF[] mPoint_map = new PointF[4];

 

mPoint_map[0] = new PointF(1.0f, 1.0f);

 

mPoint_map[1] = new PointF(1.0f, 1.0f);

 

mPoint_map[<s...
0 Kudos
3 Replies
MartyG
Honored Contributor III
162 Views

My recollection is that that when -1,-1 coordinates occur, it means that the camera cannot locate any readable depth information at that location on the image.

https://software.intel.com/en-us/forums/realsense/topic/549960 uvmap noise?

0 Kudos
LLin40
Beginner
162 Views

Hi MartyG,

I appreciate for your reply. I know that if transformed coordinates return (-1, -1), it means that the coordinates can not be located on the depth image.

However, even I used center coordinate (160, 120) of color image to do mapping process, it still showed coordinate (-1, -1) of depth image.

I really don't know how to figure out this problem.

The dimensions of color and depth image are (color:320*240) and (depth:480*360).

I even printed the log of calibration data (getCalibrationData). I don't find any error that related to my issue.

mCalibData

Depth

Resolution = 320x240

camera Id 1

FocalLength = 304.15976,304.15976

PrincipalPoint = 159.5,120.04095

Distortion

=null

Color

Resolution = 320x240

camera Id 1

FocalLength = 308.97293,308.9729

PrincipalPoint = 157.28796,121.48642

Distortion

=null

DepthToColor

translation = -58.75587 0.034289975 -0.40452477

rotation =

0.0 0.0 0.0

0.0 0.0 0.0

0.0 0.0 0.0

DepthToWorld

translation = 0.0 0.0 0.0

rotation =

1.0 -3.7416452E-11 -1.04615455E-10

-3.7416452E-11 1.0 4.499246E-11

-1.04615455E-10 4.499246E-11 1.0

Aux 4

Resolution = 640x480

camera Id 1

FocalLength = 574.8534,575.37506

PrincipalPoint = 313.09558,247.77483

Distortion

-0.011450075 0.021387124 0.0013737939 -0.0018539896 0.0

Aux 2

Resolution = 640x480

camera Id 1

FocalLength = 576.4062,577.0474

PrincipalPoint = 322.0978,244.96764

Distortion

-0.011632618 0.011111101 -0.0011944335 4.9844745E-4 0.0

BaseLine

-70.02269

0 Kudos
MartyG
Honored Contributor III
162 Views

The official documentation for the MapColorToDepth instruction confirms that (-1, -1) represents a failure to map a coordinate. Examples given for why the failure may occur are if the color at that coordinate is saturated, or if it is "floored".

https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?mapcolortodepth_pxcprojection.html Intel® RealSense™ SDK 2016 R2 Documentation

The link below defines what a "floor" of a value is.

https://www.mathsisfun.com/sets/function-floor-ceiling.html Floor and Ceiling Functions

0 Kudos
Reply