How can I find the location of barcode in an image?
Original Image
To find the location of barcode, normally differences of gradient method is taken. If we take contrast gradient across a barcode, we get high gradient in horizontal direction while low gradient in vertical direction. So where their difference (ie horizontal gradient-vertical gradient) is maximum, we take position of barcode.
Please refer to these paper: Reading Barcodes
Following links also deals with this : Link 1, Link 2