Linear barcode technology has been widely used in our common life, such as in logistics, retailed products and many other applications. Many researches and smart applications focus on how to decode the barcode so that it is difficult to locate precisely when the background becomes very complex. Moreover, many smart apps need human interaction to make sure the detected region is in a correct position of the screen. This paper presents an effective approach to locate the barcodes in real-time without manual disturbing. Basic morphological operations and Parallel Line Segment Detector (P-LSD) are applied to achieve the legal block of barcodes. Our method has been evaluated by a standard database and the experimental results show that our approach is more robuster than other earlier methods.