Inspiration

Every group chat has that one friend who posts every meal, and that other friend who's eating plain pasta for the fourth night in a row. We wanted a neutral judge to settle "is this meal a W or an L?", so we built one. It isn't a dietitian or a food critic. It's computer vision with a lot of opinions.

What it does

W Chews or L Nibbles lets you scan your meal with your camera or upload a photo. OpenCV analyzes it, gives it a score from 0 to 100, and hands down a verdict that ranges from CERTIFIED L NIBBLES to ABSOLUTE CINEMA. You also get:

  • A sci-fi "food scanner" overlay that outlines each ingredient region, labels it (SAUCE, VEGGIE, CRISPY, CHEESE…), and locks onto the plate
  • A stat breakdown: Drip, Flavor Diversity, Veggie Aura, Crispy Factor, Crunch Texture, Camera Skills, Sad Beige Index, and a Vibe Check
  • A meme and a roast that match your verdict
  • A shareable result card with rainbow text, which you can post to Discord

How we built it

The backend is Flask, and all the image work is OpenCV + NumPy. No machine learning model is involved. Every stat is a hand-built computer vision measurement.

Colorfulness ("Drip") uses the Hasler–Süsstrunk metric. With $rg = |R - G|$ and $yb = \left|\tfrac{1}{2}(R + G) - B\right|$:

$$ C = \sqrt{\sigma_{rg}^2 + \sigma_{yb}^2} + 0.3\sqrt{\mu_{rg}^2 + \mu_{yb}^2} $$

Flavor diversity converts the photo to HSV, keeps the vivid pixels (saturation $> 70$, value $> 50$), and builds an 18-bin hue histogram. It counts how many bins hold more than 3% of vivid pixels. It also measures how much of the plate falls inside the single most popular 30° hue window, which wraps around red. If one color takes over the plate, you get hit with "One-note energy."

Other signals:

  • Veggie aura is the share of saturated green pixels.
  • Crispy factor is the share of golden-brown pixels.
  • Crunch texture is Canny edge density.
  • Camera skills combines Laplacian variance (sharpness) with how close the brightness is to well exposed.
  • The plate bonus comes from Hough circle detection.

The final score is a weighted sum with penalties:

$$ S = \text{clamp}\Big(16 + \sum_i p_i - P_{\text{one-note}} - P_{\text{beige}} + v,\ 0,\ 100\Big) $$

Here $v$ is a small "vibe check" between $-5$ and $+9$. It's seeded by the SHA-256 hash of the image, so rescanning the same photo always gives the same score. A score of $S \ge 58$ is a W.

The scanner overlay splits vivid pixels into hue bands. It cleans each band with morphological opening and closing, then runs findContours so different foods get separate outlines. The result card is drawn entirely in OpenCV. That includes the rainbow verdict text, which is a hue gradient masked through the text shape.

Discord sharing works in two ways:

  1. Share links (/s/<id>) carry Open Graph and Discord embed metadata. Pasting one into any chat unfolds it into a large card preview, with a green stripe for a W and a red stripe for an L.
  2. Bot posting: you sign in with Discord OAuth and pick a server and channel. The bot then posts your card through a webhook it owns, so the message shows your name and avatar.

Challenges we ran into

  • Turning "vibes" into numbers. Tuning thresholds so a colorful salad scores higher than a plate of beige fries, without punishing a genuinely good bowl of ramen, took a lot of trial and error on real food photos.
  • Ingredient outlines merging together. Our first contour pass treated the whole plate as one blob. Splitting by hue band before finding contours is what made separate foods get separate outlines.
  • False plate detections. Hough circles kept finding "plates" in random textures. We had to constrain the radius to between 25% and 60% of the image and require the circle to stay mostly inside the frame.
  • Discord permissions. To show only channels where both the user and the bot can actually post, we implemented Discord's permission algorithm ourselves: base role permissions, then @everyone overwrites, then role overwrites, then member overwrites, with special cases for the server owner and admins.
  • Posting "as" the user. Bots can't post as people. Creating a bot-owned webhook per channel and overriding its username and avatar solved this. We also had to recreate the webhook if someone deletes it.
  • Link previews need a public URL. Discord's servers fetch previews themselves, and phone cameras need HTTPS, so localhost wasn't enough. We added proxy-aware URL handling so the app works behind Cloudflare and ngrok tunnels.
  • Small things: OpenCV's Hershey fonts only support ASCII, so curly quotes and emoji in the roasts broke the card text until we sanitized them.

What we learned

  • Classic computer vision can go surprisingly far without any trained model: color spaces, histograms, morphology, edge detection, and Hough transforms.
  • We learned how Discord OAuth, bots, webhooks, permission bitfields, and link previews actually fit together.
  • A deterministic seed is a cheap trick that makes a "random" judge feel consistent and fair.
  • Meme captions are mandatory.

What's next

  • A real food classifier alongside the vibe metrics
  • Leaderboards per Discord server
  • Weekly "W of the week" roundups

Built With

Share this project:

Updates

Submission history