bowen73
Posts: 22
Joined: Mon Jan 16, 2017 2:10 pm

how to use picam for barcode?

Mon May 08, 2017 3:24 pm

Sorry if this is in the wrong area, but another newbie question...

I want to be able to use the picam to scan a barcode and save the read barcode to a txt file.
Ive search and found things like openCV, simpleCV, python with video grab etc and feel very out of my depth as they dont make much sense to me and so many various ways.

Can anyone offer any direction on how to and which system would be best to use?

many thanks

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22257
Joined: Sat Jul 30, 2011 7:41 pm

Re: how to use picam for barcode?

Mon May 08, 2017 3:50 pm

What sort of barcode? QR?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

bowen73
Posts: 22
Joined: Mon Jan 16, 2017 2:10 pm

Re: how to use picam for barcode?

Mon May 08, 2017 3:57 pm

just standard barcode something like ean13. i think opencv can do both from what ive seen

MaDPaPo
Posts: 3
Joined: Sun May 21, 2017 10:44 pm

Re: how to use picam for barcode?

Sun May 21, 2017 10:49 pm

You cannot use picam standard to scan barcode because it does not support autofocus at driver level.you can try buy an usb webcam with autofocus or with an usb barcode scanner(with keyboard driver). Without autofocus image are software adjusted so no detection of barcode/face is possible.regards

MaDPaPo
Posts: 3
Joined: Sun May 21, 2017 10:44 pm

Re: how to use picam for barcode?

Mon May 22, 2017 5:50 am

Also opencv require autofocus in your camera.no chance to make it works with standard camera

User avatar
Gavinmc42
Posts: 2929
Joined: Wed Aug 28, 2013 3:31 am

Re: how to use picam for barcode?

Mon May 22, 2017 8:28 am

USB barcode scanners - ebay $15?
Even wireless ones, but driver may not be support?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6721
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: how to use picam for barcode?

Mon May 22, 2017 8:49 am

MaDPaPo wrote:Also opencv require autofocus in your camera.no chance to make it works with standard camera
Where do you get that one from?

Support for auto focus is in OpenCV when handling V4L2 sources, but from my reading of the source it is not mandatory for the device to support it. Doing so would be surprising as it would significantly reduce the number of devices that could be used with OpenCV - not a good way to encourage people to use your software.
https://github.com/opencv/opencv/commit ... debf9R1374

Or use the Raspberry Pi specific interface library for OpenCV - https://github.com/cedricve/raspicam No requirement for auto focus there.
Gavinmc42 wrote:USB barcode scanners - ebay $15?
Even wireless ones, but driver may not be support?
Most of them show up as USB HID (Human Interface Device), aka a keyboard. On barcode read they just create keypress events for the read data, so no specific driver required.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Camera board”