Colonoscopy is the preferred screening modality for prevention of colorectal cancer. Colonoscopy has contributed to a marked decline in the number of colorectal cancer related deaths. However, recent data suggest that there is a significant miss-rate for the detection of even large polyps and cancers. There was no automated measurement method to evaluate the quality of a colonoscopic procedure. To address this critical need, we have been investigating automated post-procedure quality measurement system. The limitation of post-processing quality measurement, however, is that quality measurements are available long after the procedure was done and the patient was released. We aim to achieve real-time analysis and feedback to aid the endoscopist towards optimal inspection to improve overall quality of colonoscopy during the procedure. Colonoscopy consists of two phases: an insertion phase and a withdrawal phase. One of the most essential tasks for the real-time quality measurement is to find a phase boundary between insertion and withdrawal phases in real time. In this paper, we will discuss how to find the phase boundary in real time. Our experimental results are promising.