The image processing algorithm of searching formation in the lungs has been proposed for computer tomography scans. The approach is based on clustering to detect some regions in the image. Different heuristics were suggested to detect lungs on the image and to discard some objects that are not to be detected by the algorithm. The algorithm has been implemented and tested for the real image database of x-ray computer tomography. Future improvements for the proposed approach were suggested