# Help reading data from a game (Diablo II) or analyzing an image from it for text recognition

**URL:** <https://discourse.processing.org/t/help-reading-data-from-a-game-diablo-ii-or-analyzing-an-image-from-it-for-text-recognition/21782>\
**Category:** Project Guidance\
**Created:** [June 11, 2020, 5:11pm UTC](https://discourse.processing.org/t/help-reading-data-from-a-game-diablo-ii-or-analyzing-an-image-from-it-for-text-recognition/21782 "2020-06-11T17:11:41Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [June 11, 2020, 7:55pm UTC](https://discourse.processing.org/t/help-reading-data-from-a-game-diablo-ii-or-analyzing-an-image-from-it-for-text-recognition/21782/4 "2020-06-11T19:55:35Z")

</div>

Because you only care about 10 character – 0-9 – and they are in a wacky low-rez font, you could collect character streams using template matching.

BoofCV for Processing already supports template matching.

- [BoofCV now includes QR code detecting, templates, and motion detection](https://discourse.processing.org/t/boofcv-now-includes-qr-code-detecting-templates-and-motion-detection/4698)
- [https://boofcv.org/index.php?title=Example\_Template\_Matching](https://boofcv.org/index.php?title=Example_Template_Matching)

Use the provided Template example from the BoofCV library, Crop copies of the numbers into 10 files with 10 masks, and bam – bespoke OCR data. Since your matches are on a single line, you can just sort hits by their x coordinates to reconstruct the string.

![Screen Shot 2020-06-11 at 12.54.35 PM](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/b14d3d1036c4b2217bd572947985f8e6f65eb5c2.png)

Example template (crop) and mask (black and white, e.g. in Gimp or Paint / Photoshop):

![4](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/fc76346b4eda6527df0d13154d520ba50d525819.png)  
 ![4_mask](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/7058917c541dfdf96dbbde6efb54916da5ceab15.png)

**Edit** caveat–you need scores for template matching to work like this, and I haven’t tested whether they were added to the library yet. See the thread I linked above.

---

_[View the full topic](https://discourse.processing.org/t/help-reading-data-from-a-game-diablo-ii-or-analyzing-an-image-from-it-for-text-recognition/21782)._
