Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

Error in Mapping Depth to Color Coordinates using UV Mapping

himanshu_p_
Beginner
693 Views

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
jb455
Valued Contributor II
693 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
himanshu_p_
Beginner
693 Views

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

0 Kudos
Reply