Aiming at possible application to detection of several kinds of architectural objects such as windows from two-dimensional digital images, this paper proposes an efficient algorithm for detecting rectangular components in a binary edge image by limiting target objects to those having so-called slicing structure. The proposed algorithm first identifies the regions where ractangular objects may exist by projecting the image intensity data to two axes. It then further narrows the set of candidate edges that are supposed to form a part of rectangles by applying an efficient dynamic programming algorithm. It has been demonstrated through computational experiments that our algorithm attains much higher efficiency and detection accuracy compared with an existing method.