1

I need to make a Barcode/QR code reader from video.

It could be captured from an image with a built in code, but I could not figure it out how it could be done by video.

Let me tell the big picture. I will use as an identification. For example, somebody shows it as an ID to camera, so code will scan the list whether the code is listed or not. If it is listed, it will bring the information about the person. Thus, security guards will open the door or let the person enter.

forumcash
  • 557
  • 5
  • 14
  • Duplicate: http://mathematica.stackexchange.com/questions/33093/is-there-a-mathematica-barcode-reader – David G. Stork Mar 17 '15 at 20:52
  • @DavidG.Stork they are not same things. I need Mathematica to read from video.

    Reading from an image is not a problem. BarcodeRecognize[image] will solve the problem

    – forumcash Mar 17 '15 at 20:58
  • Try running the barcode reader on stills captured from the video. – David G. Stork Mar 17 '15 at 21:05
  • I though that way, but it should capture regularly, every second or every three second. Is there anyway to capture regularly? – forumcash Mar 17 '15 at 21:07
  • 2
    Take a look at RunScheduledTask or Dynamic in order to what you want to do regularly; use CurrentImage to fetch the image from the source and try to use BarcodeRecognize and see if it works. If BarcodeRecognize does not work then we will need to see the images in order to help. Hint: If you get the problem that BarcodeRecognize is too slow you can try to make the images smaller. (But then it will be even less likely to work, so be careful. Experiment.) – C. E. Mar 17 '15 at 21:25
  • Dynamic changes the format from image. Thus, BarcodeRecognize gives error. RunScheledTask is not running at all. Even though I try examples from documentation. – forumcash Mar 20 '15 at 00:04

1 Answers1

5

Following code takes a snapshot every four second and test it whether it is Bar-code/QR code or not. If it is a valid code it writes the information database.txt file by separating with commas. In my QR codes, first three characters is ID number, one space, and full name. It saves this information with the scanning time. It takes total 20 snapshots and stops if it is not aborted.

RunScheduledTask[snapshot = CurrentImage[]; 
test = BarcodeRecognize[snapshot];
If[StringQ[test],str = OpenAppend["database.txt"]; 
WriteString[str, StringTake[test, 3], ",", StringDrop[test, 4], ",",
DateString[], "\n"]; Close[str];];, {4,20}];
forumcash
  • 557
  • 5
  • 14