The steel industry heavily relies on manual labor and the use of photoelectric sensors and complex counting machines to count steel bars. In the last decade, research on the automatic detection and counting of steel bars by using image processing and computer vision techniques have seen much progress. Nevertheless, most of past research focused mainly on circular shaped steel bars from a direct frontal camera angle. In this paper, we propose a method that is adaptable to both circular and rectangular shaped steel bars, and robust towards different camera angles and lighting intensity. The captured digital image first undergoes an essential pre-processing stage followed by edge detection which extracts the steel bar edges. For circular shaped steel bars, we apply Hough Transform followed by a post-process while the rectangular ones can be accurately found based on a series of morphological operations. Experiments conducted on a variety of challenging conditions demonstrate the capability of our approach to a good measure of success.