title: How to convert the depth map to 3D point clouds?
body: <p>When I convert depth map to 3D point cloud, I found there is a term called scaling factor. Can anyone give me some idea what scaling factor actually is. Is there any relationship between scaling factor and focal length. The code is as follows:</p>
  
  <pre><code>import argparse
  import sys
  import os
  from PIL import Image
  
  focalLength = 938.0
  centerX = 319.5
  centerY = 239.5
  scalingFactor = 5000
  
  def generate_pointcloud(rgb_file,depth_file,ply_file):
  
      rgb = Image.open(rgb_file)
      depth = Image.open(depth_file).convert('I')
  
      if rgb.size != depth.size:
          raise Exception("Color and depth image do not have the same 
  resolution.")
      if rgb.mode != "RGB":
          raise Exception("Color image is not in RGB format")
      if depth.mode != "I":
          raise Exception("Depth image is not in intensity format")
  
  
      points = []    
      for v in range(rgb.size[1]):
          for u in range(rgb.size[0]):
              color = rgb.getpixel((u,v))
              Z = depth.getpixel((u,v)) / scalingFactor
              print(Z)
              if Z==0: continue
              X = (u - centerX) * Z / focalLength
              Y = (v - centerY) * Z / focalLength
              points.append("%f %f %f %d %d %d 0\n"% 
  </code></pre>