Hi guys,
Is there a document that goes into the theory behind the hybrid thee phase + gray code algorithm implement by TI. I am looking for a really low level explanation. Does such a document exist?
Basically I am looking for an in depth explanation on what is happening in the function DecodeCaptureSequence in ThreePhase.cpp
I understand most of the function but there are a couple of lines to do with the phase unwrapping that I don't understand. The section of code that I am trying to better understand is below
// Calculate the wrapped phase phase_value = atan( sqrt(3.0) * (intensity_phase_n120 - intensity_phase_p120) / (2.0*(intensity_phase_0)-(intensity_phase_n120)-(intensity_phase_p120)) ) / THREE_PHASE_PI; if((phase_value >= 0.5) || (phase_value <= -0.5)){ // Pixel is invalid disparity_value = dlp::DisparityMap::INVALID_PIXEL; } else{ // Convert the phase to a wrapped pixel value disparity_value = lroundf(over_sample*(phase_value + 0.5) * ((float)this->resolution_) / this->phase_counts_); // not sure what this line is doing if(this->use_hybrid_.Get()){ // Get the gray code disparity pixel value gray_code_disparity.Unsafe_GetPixel(xCol,yRow,&gray_code_disparity_value); //disparity_vals[(unsigned int)gray_code_disparity_value]++; if((gray_code_disparity_value != dlp::DisparityMap::INVALID_PIXEL) && (gray_code_disparity_value != dlp::DisparityMap::EMPTY_PIXEL)){ // Check that the phase change regions are correct if(((gray_code_disparity_value+1) % 4) == 0){ // Not sure on this line // The fourth region of a period should be greater than // 0.25 and absolutely greater than 0. If it is less than // zero the phase has been missclassified if(phase_value < 0) gray_code_disparity_value++; // not sure what this line is doing } else if(((gray_code_disparity_value+1) % 4) == 1){ // The first region of a period should be less than // -0.25 and absolutely less than 0. If it is greater than // zero the phase has been missclassified if(phase_value > 0) gray_code_disparity_value--; // not sure what this line is doing } // Adjust the GrayCode disparity value to the phase regions gray_code_disparity_value = gray_code_disparity_value / 4; // not sure what this line is doing // Add the GrayCode disparity value to unwrap the values disparity_value += (over_sample*gray_code_disparity_value*this->resolution_/this->phase_counts_); // not sure what this line is doing } else{ disparity_value = dlp::DisparityMap::INVALID_PIXEL; } } else{ // Non hybrid method not implemented disparity_value = dlp::DisparityMap::INVALID_PIXEL; } } // Save the calculated pixel value this->disparity_map_.Unsafe_SetPixel(xCol,yRow,disparity_value); } }
Any help would be greatly appreciated
Thanks
John