Symbol extraction from video

Is there an example program for character recognition available?

be more specific?
OCR?
examining a graphic image?
reading a live camera picture?
what?

Dave, thanks for the response. I hope to take a video of the screen of a casino video poker machine to tally accurate statistics of the cards dealt. After it’s loaded into the computer (probably as an mpeg file), how can I analyze the card images in a slightly unstable video? There are only 5 card images, each with one of only 13 ranks and 4 suit symbols. These are large images, not the small characters of actual playing card images.

Good luck with that… :slight_smile:
It CAN be done… but I’m sure it is beyond the subject experts you will find here.

I hope someone here will prove that wrong.

To increase your chances, write a better title, because not everyone will read into every thread, but just browse the titles for “interesting” topics. Also, try asking on StackOverflow, again giving more details. Make it clear you look for a solution that runs on a “PC” (I assume you don’t want to do this all on an iPhone) and whether you’re willing to use online services for the recognition or are looking for a completely offline solution.

The TesseractMBS class in MBS Xojo Images Plugin can be used to recognize text and can be limited to only detect numbers.

Thanks, Thomas, for the suggestion. Is the new title better?

Thanks, Christian, for the plugin links. I’ve had problems with plugins and I’m hoping to be able to do it in Xojo code.

not to push you to use @Christian Schmitz’s plugins but his are rock solid and if there is ever an issue, he is johnny on the spot to fix them.

and I don’t know any way to identify symbols (or letters or characters) from images without using a plugin like mentioned. If you can, more power to ya.

—sb

Thanks, everyone. The question is not whether the plugin would work but whether I can figure out how to use them. I started with a plugin for the game analysis in Optimum Video Poker but ended up rewriting it in Xojo code (actually RealStudio code at the time). But of course that’s all math, not image processing. Still hoping for ideas.

I wonder if there’s a Xojo programmer here in Las Vegas, NV, who would be interested in this project, or at least in getting me started with the plugin.

I looked into the plugin links. Two problems:

  1. This is just a personal pet project, so there’s no justification to pay for a plugin license.
  2. I couldn’t understand the Xojo example code. There’s not a single comment.

So I guess this isn’t going to happen unless I can program it in RealStudio code.

If you’re on Mac, you can do some of the things without a plugin.

  1. Extract frames from a movie. AVFoundation API.
  2. Find text in the frame. CoreImage API.

Apple do not publicly provide access to OCR technology (that I know of), only a function for telling in what area of an image does it contain text.

Stabilizing video is a whole science on it’s own, a cheap hack is to upload it to YouTube, let YouTube stabilize it and then download it.

In order to use either of these, you’d need to learn about declares, how to read and understand Objective-C, and probably Swift now that Apple default their docs to Swift, while most sample code on the web is in good old Obj-C.

It’s not impossible, but it will take some time to learn enough to be able to accomplish it.

Amazing. The best suggestions come from our great friends in Taiwan. Thank you, Sam. I’d love to visit your country some time.

I started to learn C++ before I found RealStudio, so I shouldn’t have much trouble learning Objective-C.

I don’t think it would be necessary to stabilize the video. I just need to select one frame of many. It takes about 5 seconds to play one hand of video poker. That’s 150 frames of the video. Only two of those are necessary, one after the deal and one after the draw, and selecting those two frames shouldn’t be too difficult.

Can someone give me an example of Xojo code to extract one frame at a time from a mpeg file, then how to look at the pixels in that frame? (Actually I do most of my work in an old copy of RealStudio then do a final build in Xojo so that it will run on current systems.)

I don’t have any value to contribute to this conversation, but I just enjoyed that quote. Please check back in a few months and let us know how that went. :slight_smile:

A wounded warrior of the Obj-C battle.

Seems like you missed the Xojo developer meetings I made for Las Vegas in the past years.

[quote=379002:@Dan Paymar]I looked into the plugin links. Two problems:

  1. This is just a personal pet project, so there’s no justification to pay for a plugin license.
  2. I couldn’t understand the Xojo example code. There’s not a single comment.

So I guess this isn’t going to happen unless I can program it in RealStudio code.[/quote]

Look up “Image recognition” on Wikipedia at https://en.wikipedia.org/wiki/Optical_character_recognition

This algorithm can be used to match the pictures against previously stored pics :
https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm

Mind you, what you want to do is much more complex than anything you may have encountered so far, especially if the machines you want to analyze results from use different designs. I have no doubt it can eventually be done in RB/Xojo, but it is far from being a weekend project…

Thanks for the second link, Michel. I realize I started this thread with the wrong title. This is not character recognition in the sense of reading printed text. I like the idea of searching the screen image for matches with previously stored pics since there are only 19 different icons to recognize (13 ranks, 4 suits, and the Deal/Draw button).

I don’t think there will be a problem with different designs since all the machines of interest are made by IGT. Generally, the only variations are the background color.

Can someone point me to an example of Xojo (or RealStudio) code to extract one frame at a time from a mpeg file, then how to look at the pixels in that frame?

Is that Mac? Windows? Linux?

for Mac, you can use AVAssetImageGeneratorMBS class in MBS AVFoundation Plugin.