Structured light techniques have received increased attention for depth estimation as they are robust and accurate. In this paper, we propose a method for camera-projector calibration which is required for structured light based depth estimation. We also propose enhancements to the existing hierarchical orthogonal coding (HOC) technique. The proposed space calibration technique is simple and fast compared to current camera-projector calibration techniques. The existing HOC, though being robust to ambient environmental lighting conditions, fails at occluded regions due to its pixel decoding strategy. With this in mind, we propose a self occlusion detection method to detect such ‘shadows’ in advance and to recommend to readjust the camera-projector positions to eliminate the shadows. Additionally an address transition rule is also proposed to correct any erroneously detected code. The proposed method is evaluated by computing the depth maps of objects of different known shapes.