• Link to LinkedIn Link to LinkedIn Link to LinkedIn
  • Link to Facebook Link to Facebook Link to Facebook
  • Link to Bluesky Link to BlueskyLink to Bluesky
  • Link to Mastodon Link to MastodonLink to Mastodon
  • Link to Mail Link to Mail Link to Mail
  • Link to Rss Link to Rss Link to Rss
  • Dogsbody Technology Charity Support 2025
Contact us: 01276 818576
Dogsbody Technology
  • Emergency support
  • Infrastructure Services
    • Infrastructure Design
    • Infrastructure Build
    • Server management and monitoring
    • In-life Support
    • Pen Testing & Audit
    • Hosting Services
      • Plesk Hosting
      • VPS & Dedicated Servers
      • Tor Hosting
  • Happy Customers
  • About Us
  • Careers
    • Write your own job
  • News & Views
  • Contact Us
  • Menu Menu

Hackathon – Image Recognition Slackbot

27 Nov 2018/0 Comments/in Activities/by Jim Carter

Our internal hackathons give us extra opportunities to play with software and carry out quick projects we can’t usually justify sinking time into.

A while ago we built our Slackbot, it’s a bit of fun, from providing inspirational quotes to tracking who’s made the most cups of tea. It’s well on it’s way to doing everything you never wanted.

The Problem

DogsBOT reacts to discussions regarding lunch. Initially this was with ? emoji. Since we don’t eat spaghetti every day I switched it to the ? emoji but this also became routine.  What we needed was a less predictable, more intelligent reaction.  My criteria for this was:

  • Linked to the current weekly menu
  • Some element of chance

A Solution

The canteen menu for the week is available as a PDF on the site intranet. It was an easy choice to use it as the source for DogsBOT’s lunch reactions.  As there are multiple options each day DogsBOT would be able to pick one for today at random.

With that decided we just needed to convert the PDF of the menu to text.  Given my bias to use python, a quick google indicated PyPDF2 would be the perfect tool. Unfortunately the menu turned out to be almost entirely images.  All I was able to pull out was the title and a bunch of meta data.  I needed to switch to an image recognition tool.

For the image recognition I wanted to run the code locally so ignored the various cloud solutions.  This still left a lot of choice of software.  I found this guide which did everything I was looking for using OpenCV (to clean up the image) and Tesseract (to pull out the text).

Now I’d got the text, I needed to work out which day the food would be served on. I was starting to run out of time so I set-up a quick loop.  It assumes each item is from the day of the week it most recently passed.  Happy that this was mostly working so I moved on to converting the food to emoji.  I did this by attempting to convert each word to an emoji and using the ones that were successful.  In hindsight I would have been better off selecting reactions based on shortnames in this data as Slack reactions use them rather than emoji.

Conclusion

The new improved lunch plugin mostly works.  I had fun playing with PyPDF2, ImageMagick, OpenCV and Tesseract as well as learning a little more about how Slack reactions work.

Tesseract is impressively good.   Given that I’d been planning to just pull the text out of the PDF I didn’t spend huge amount of time comparing it with the alternatives since it did everything I needed.  If spent more time on this I’d like to spend more time tweaking the OpenCV commands to work with different lower quality images.

More hackathons

Whether we’re fitting out a storm trooper or camping in a field we all love spending a day out doing something different.  For our next hackathon we’re planning to try and break in to our internal servers.  If you’ve got any hackathons lined up you think we’re missing out on let us know in the comments.

Tags: Hackathon
Share this entry
  • Facebook Facebook Share on Facebook
  • Whatsapp Whatsapp Share on WhatsApp
  • Linkedin Linkedin Share on LinkedIn
  • Reddit Reddit Share on Reddit
  • Mail Mail Share by Mail
https://www.dogsbody.com/wp-content/uploads/pizza.png 212 885 Jim Carter https://www.dogsbody.com/wp-content/uploads/Dogsbody-site-logo-1.png Jim Carter2018-11-27 11:33:462018-11-27 11:33:46Hackathon – Image Recognition Slackbot
You might also like
Five Go on a Hacking Weekend
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

We are Dogsbody. We take the pain away from building, securing and maintaining IT infrastructure.

Find out how we can help your business

Everything we do is about security. Our team is our strength.

Get in touch

Latest thoughts and news

  • Our Trusted Suppliers after 15+ Years
  • Avoid Surprise AWS RDS Charges in 2026
  • A Season of Giving: Dogsbody Technology Charity Support 2025
  • Wrapping Up 2025: Our Christmas Hours
  • PHP 8.1 will go end of life – 31 Dec 2025
Search Search

Useful links

  • About Us
  • Dogsbody News & Views
  • Contact Us

Linux & cloud services

  • Infrastructure Design
  • Infrastructure Build
  • In life Support
  • Infrastructure Audit
  • Penetration Testing
  • Hosting Services

In life support

  • Overview
  • Helpdesk support
  • Server management and monitoring

Careers

  • Working at Dogsbody
  • Write your own job description
© Copyright 2010-2026 Dogsbody Technology Ltd - Registered in England and Wales 07236558
  • Link to LinkedIn Link to LinkedIn Link to LinkedIn
  • Link to Facebook Link to Facebook Link to Facebook
  • Link to Bluesky Link to BlueskyLink to Bluesky
  • Link to Mastodon Link to MastodonLink to Mastodon
  • Link to Mail Link to Mail Link to Mail
  • Link to Rss Link to Rss Link to Rss
  • Contact us
  • Terms of use
  • Privacy policy
Link to: Introducing Dogsbody Internal Hackathons Link to: Introducing Dogsbody Internal Hackathons Introducing Dogsbody Internal Hackathons Link to: 2018 Christmas Shutdown Link to: 2018 Christmas Shutdown 2018 Christmas Shutdown
Scroll to top Scroll to top Scroll to top