Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
34 Views

Error in Mapping Depth to Color Coordinates using UV Mapping

Hi,

I have Intel RealSense F200 camera, trying to Map Depth to Color Coordinates using UV Mapping, through the following code.

CodeSnippet:--

                        PXCMCapture.Sample sampleCD = senseMgr.QuerySample();
                        PXCMImage depth= sampleCD.depth;
                        PXCMImage color= sampleCD.color;
                        
                        PXCMProjection projection=device.CreateProjection();// Create the PXCMProjection instance.
                        
                        
                        // color and depth image size.
                           PXCMImage.ImageInfo dinfo=depth.QueryInfo();
                        PXCMImage.ImageInfo cinfo=color.QueryInfo();
                         
                        // Calculate the UV map.
                        PXCMPointF32[] uvmap=new PXCMPointF32[dinfo.width*dinfo.height];
                        projection.QueryUVMap(depth, uvmap);
                         
                        // Translate depth points dBuffRaw[] to color depthToColor[]
                        float depthToColor[]=  new float[dBuffRaw.length];
                        for (int y=0; y <  dHeight-1; y++) 
                        {
                            for (int x=0; x <  dWidth - 1; x++)  
                            {
                                    for (int i=0;i<dBuffRaw.length;i++) {
                                        depthToColor.x=uvmap[(int)dBuffRaw.y*dinfo.width+(int)dBuffRaw.x].x*cinfo.width;
                                        depthToColor.y=uvmap[(int)dBuffRaw.y*dinfo.width+(int)dBuffRaw.x].y*cinfo.height;

                                 }
                            }
                        }

I am getting error "x cannot be resolved or is not a field"  "y cannot be resolved or is not a field"  on above bold lines.

 

regards,
Himanshu

0 Kudos
2 Replies
Highlighted
Valued Contributor II
34 Views

You've set up depthToColor[] as a float array. Presumably you want it to be a PXCMPointF32[] array instead? That's the only obvious problem I can see. If you fix that and it still doesn't work I'll take a closer look for you.

Let me know how you get on!
James

0 Kudos
Highlighted
Beginner
34 Views

Thanks James for your prompt reply......I got the solution..... 

0 Kudos