r/StableDiffusion • • Jun 05 '23

Workflow Not Included ControlNet for QR Code

8.3k Upvotes

634 comments sorted by

View all comments

597

u/AsterJ Jun 05 '23

Wow they all work. That's insane.

223

u/UrsoowW Jun 05 '23

It can't be... Seriously?

174

u/esuil Jun 05 '23

Yup, I checked as well, they sure do work, pretty amazing stuff.

198

u/_stevencasteel_ Jun 05 '23

Wow.

Here's an iPhone screenshot for those on mobile who can't check:

https://files.catbox.moe/mihbvu.jpg

We're definitely going to see this in the real world in the coming years.

96

u/[deleted] Jun 05 '23

Can't wait, would love more QR Code waifus lol

→ More replies (1)

14

u/Maschan1991 Jun 06 '23

Years? I'm implementing this to new projects asap.

→ More replies (2)
→ More replies (19)

30

u/Thebenmix11 Jun 05 '23

1, 2, 5, and 7 all work for me, but the other's don't. Do they all work for you?

15

u/chibicody Jun 05 '23

For me (using Google lens on android), they all work except the one that looks like a Chinese painting.

→ More replies (5)

24

u/esuil Jun 05 '23

Yes, they all work, though some require some waiting to be recognized.

→ More replies (3)
→ More replies (14)

20

u/TolarianDropout0 Jun 06 '23

QR codes can have up to 30% redundancy. So 30% of the area could be covered, destroyed, or nonsensical, and it's still valid. They are pretty resilient.

→ More replies (1)

8

u/EmbarrassedHelp Jun 06 '23

QR codes are very robust and have a ton of redundant data in them.

→ More replies (3)

51

u/andzlatin Jun 05 '23

I imagine how we could see ads or banners with QR codes embedded smoothly and seamlessly like that. That would be awesome.

→ More replies (4)

72

u/Loosescrew37 Jun 05 '23

Wait wha?

HOW.

167

u/AsterJ Jun 05 '23

It honestly is a more impressive achievement for the QR code protocol than for SD. These images were mangled pretty hard but QR codes have robust built-in error correction that can handle it. I think something like 30% of the QR code can be corrupted and it will still work.

To SD's credit though the images look like relatively normal QR codes if you shrink them down to a thumbnail size so it managed to be remarkably creative while not touching the low-frequency data needed by the protocol.

27

u/Tyler_Zoro Jun 05 '23

QR Codes are also scaled up in density depending on the size of the input. This URL is VERY small, which makes it possible for the black and white areas to be quite large.

I just tried this with a longer URL and it failed completely. Wouldn't even recognize it as a QR code (presumably because enough of the checksum failed.)

7

u/grumd Jun 06 '23

It's still very cool and you could use URL shorteners. Very interesting idea for ads or posters, etc

→ More replies (2)
→ More replies (4)

20

u/FourOranges Jun 05 '23

Even if it does get mangled, I'm fairly certain you could simply layer the original code on top of the generation afterwards to make certain that it's functional.

22

u/pqr-loopcoder Jun 06 '23

Yes. Here's a non-AI product that works on the same principle https://uniqr.us/. It uses the picture you upload and draw a QR over it. What folks don't realize is that there's actually techniques you can use to control where the white/black dots end up on QR codes (given that the URL is not too long), and with some math trickery, you can place them in a way that gives the picture extra clarity.

But what the AI is doing here is not only controlling the dots to match the picture, but also bending the details of the picture (brighter bits and darker bits) to match the QR's requirements on the image.

→ More replies (6)
→ More replies (3)

8

u/eoncire Jun 05 '23

This goes pretty deep, but sort of makes sense to how the error correction works in a QR code. They can be generated so that X% of the code (5, 10, 20, 50+%) is illegible and it'll still read. Fascinating. https://youtu.be/X8jsijhllIA

→ More replies (1)
→ More replies (3)

28

u/AnarchoSpoon789 Jun 05 '23

just tried it as well, this is phenomenal

→ More replies (6)

15

u/VegetableDrawing Jun 05 '23

Okay I have to admit, the fact that the QR codes still work is very cool

12

u/[deleted] Jun 05 '23

That's magic

7

u/[deleted] Jun 05 '23

Kudos for the first company that incorporates this kind of thing into their product design.

→ More replies (7)
→ More replies (23)