Hacker News new | comments | show | ask | jobs | submit login
The Girl with the Brick Earring (lucaswoltmann.de)
377 points by plumbumsel on Nov 24, 2017 | hide | past | web | favorite | 57 comments

Yikes, doing a color conversion by nearest-neighbor RGB is guaranteed to give odd results like this. The entire center of her dress has undershot the blackpoint and is washed out entirely in black, and the representation of the headdress is extremely high variance. These are similar problems to people what people face attempting to print out digital photos or artwork without properly managed color.

At a minimum you would want to adjust the color gamut of the image by hand to line up with the lego color gamut so the end result is more pleasing, more concretely that means spending some time on the hue/saturation/lightness/color curve filters until those conversion artifacts are minimized. A more theoretically interesting way to do it would be to use a gamut matching algorithm with a discrete color space defined by the available lego bricks.

http://www.colourphil.co.uk/rendering_intents.shtml http://cs.haifa.ac.il/hagit/courses/ist/Lectures/IST12_Color...

Everybody here is drawn to the picking of the colors. But the optimization of the different sized pieces also seems like a very fun problem to work on!

And taking the step to actually getting out of the digital world is something everybody should probably do more often!

This is indeed an interesting problem. If you just want to minimize the number of rectangles there is a neat solution on stackoverflow [1] that uses minimum vertex cover (equivalently, bipartite maximum matching).

[1] https://stackoverflow.com/a/6634668

But the goal here really isn’t to minimize the number of pieces used. It is to minimize total cost of covering the space. This makes things much more complex as it turns into some weird variant of a knapsack problem.

On a similar theme, what began as a weekend hack to help my wife design a patchwork quilt based on an image of Groucho Marx ended up as https://www.youpatch.com.

In this case, the aggregation algorithm not only creates rectangular areas, but also avoids the need for the quilter to have to sew Y-seams.

Here's my talk from RacketCon: https://www.youtube.com/watch?v=8psnTEjYIEA

I think this is my favorite pixel art rendition of that painting:


Yes this is nicer!

mine too!

> This is done by finding the nearest neighbours in the RGB space.

Noooooo. RGB is not useful for anything but computer displays. Always use a suitable color space if you want to calculate with color values. Eg a CieLAB one or similar.

You are right. This was one of the first feedback, I've got from others as well, so I added LAB. It is currently not in the repo (sry about that), but here is an image for comparison: https://imgur.com/a/FVieK I was left with the impression that RGB was sufficient for my simple cases.

Nice! I feel bad that my criticism is the highest comment at HN at the moment and how I did not even say how much I enjoyed reading your post. Great project which I will share with my students for inspiration. :)

But RGB is simple code. I have run a site for years that converts photos into craft designs, and calculates with RGB. It might not be the best solution, and there are concerns with the color matching....but it is good enough to have now produced over 580K designs, gotten positive feedback, and has resulted in small side income for years. (And I recently sold the site.)

Sometimes "good enough" works.

XYZ (or Yuv) is also simple, since it is a single 3x3 matrix conversion away from RGB and it is relevant to huuman perception rather than display capability. In some cases people may not notice, but it others RGB-NN is clearly not the best... so why not try a bit harder, when it's a few lines of code and opcodes.

You’re right to say that “good enough works”, but IMO wrong to use this as a criticism of the parent posts which did a good job of explaining why it’s best practice to avoid RGB in this context of image processing (vs YUV for example, which is incredibly easy to implement in a few dozen lines of code). Context is important, and we are discussing a situation in which RGB is demonstrably insufficient.

Even beyond that though, there is something to be said for seeking to approach perfection. Nobody is requiring or expecting perfection, but when someone offers an easy way to get closer to it, it will rub many the wrong way when someone rebukes the helpful suggestion with the excuse of “good enough is fine, so stop providing helpful product improvement advise!” This is how you achieve mediocrity.

Not sometimes! "Good enough" is ALWAYS... good enough! :)

That may be good enough for you, but it's not good enough for me.

If I can make enough money from people who pay me because it's good enough for them, that's good enough for me.

You've perfectly described the market force that drives quality away from every product.

Which shows that you have to lay bare what your values are before arguing about how to optimize them.

I think going for anything BUT rgb based on a digital rgb source image is beyond the scope of this experiment. You are not dealing with a real image, don't bother with real color space, ESPECIALLY if you filter it all down to a palette that is even more limited.

EDIT: after looking into this: CieLAB is still beyond scope, but a good solution for nearest color when you want to be accurate to that degree.

But distances don't mean anything in the RGB space, so NN is meaningless

Just did a quick test with both HSV and LAB and honestly RGB seems to give the best results at least to my eye.

This seems to be to be one of those cases where the simple and obvious approach appears to give a better result than the 'correct' approach

Distances in RGB space certainly mean something in the sense that you get a rough approximation that gets more convincing the more colors you quantize to. Decent for some purposes, while for others you need a space that more closely maps to human perception.

While you are of course correct, it would be interesting to see how much the choice of color space actually matters in this particular case.

They aren't meaningless, they just aren't perceptually linear.

Funny but true, the Daily Mail beat you to it:


There are a few other pictures and how well the medium of Lego works for pixelated art.

There are a few people on this thread posting 'things made with Lego' which is a different thing to using Lego for pixelated art.

I think that you could build a small business out of making pixelated Lego for people wanting to buy their new-borns some Lego. Imagine if in the bedroom the Lego starts as a bright picture on the wall, out of reach. Then when they can reach it then see what happens. If they have no Lego then do they work out that you can make things with it? Or do we need marketing and instructions with box artwork?

Also interesting would be a Lego sorting machine that you tipped random bricks into for it to then print out as pixelated art. It would scan the bricks and then show you exactly what images you could make from the bricks and also dither a given image to the palette and availability provided by the bricks dropped into the sorter.

I remember bending out of shape trying to code a program for my mother to help with her (short lived) cross-stitching adventures. Gave up and discovered program (lot's of them as a matter of fact) which prepared excel sheets from image files and decided on colours based on thread manufacturer catalogs.

I'll say cross-stitchers beat everyone to it.

Funny², because that was my first inspiration, but as of my understanding he is not using "real" LEGO colours.

I think you and I would have built some amazing Lego together had time and geography brought us together in childhood times. There are rules of aesthetics with Lego that a lot of people/kids just did not get. If building a house then the colours would have to be right, or best given available bricks. Some kids just put stuff together with any colours. Not good design. I can't remember guidance from parents on brick colour etiquette and style, that was something we worked out to do, or not, as the case may be.

Nice programming exercise, but I just want to say that Lego can be more than glorified pixels. If you take advantage of all it offers, it becomes a creative medium of its own: https://i.pinimg.com/564x/04/74/44/0474444cf5278174b50a135f6...

Technically, that's comparing a painting to a sculpture. Although Lego is obviously a "sculpture first" kind of medium.

Not trying to be too literal, but a large part of the point of Lego is to be a creative medium, no?

Interesting. Lego mosaic makers are one of the more frequent customers that I have for the output of the sorter. They take many kilos of plates and tiles in a single order.

Very cool project btw, really liked your write ups. Here’s an article for those unfamiliar: https://spectrum.ieee.org/geek-life/hands-on/how-i-built-an-...

Made any updates to your neural net implementation? I’m working through some deep learning intro courses right now, and I can better appreciate your approach.

Way too many VC's doing just one more deal before the end of the year so we're swamped with other work. But that translates into a slump in Jan / Feb so probably I'll have some more free time then to work on it. What also doesn't help is that I moved it out of the house because it became faster and faster and as a result louder as well. About 4000 parts / hour now :)

LEGOs shuffling are surprisingly loud in a box, let alone through chutes at 4K/hr! Glad it’s a fun side project to maintain.

Are there any other commercial lego sorters?


I wonder what it would look like scaled up to a higher resolution with a dithering algorithm applied. With the extremely limited palette of lego bricks you'd have to get pretty creative with the dithering to get an accurate representation, it seems like a fun problem.

Look at pixel art for the C64 etc. and you'll see how creative dithering like that can get, but it also tends to show that the end result will often be better if you deviate more.

With pixel art that uses models, part of the challenge tends to be not to be as accurate as possible, but to deviate in the ways that best brings out the overall qualities of the image.

E.g. in this case I'd argue that the big flaw in the end result was to not bring out the blue in her head-dress and the white and black in her eyes, and ensuring the back of her head and back is actually visible, at least with a dark grey outline, as well as the red line of her mouth.

Likewise, sacrificing some of the lines in her headdress for less texturing but hinting at it with maybe one line would probably look better.

I don't want to diminish it in terms of demonstration of the methods in the article - it's great as a means of showing what you can do with them. But it also demonstrates shortcomings of those methods (but that's good too).

My friend does lego brick art works, https://www.pinterest.co.uk/oxfordbrickart/lego-mosaics/, I prefer his R2' but over all the greyscale ones seem better, particularly Holly Golightly[1] and the Cyberman (separate pictures!).

[1] https://www.youtube.com/watch?v=k9ENEj33t4M construction video

If you manage to get a hold of old Lego bricks, there are a few more colors available. https://www.bricklink.com/catalogColors.asp

Cool approach to quantize and pixelated an image to make it look like it is made out of LEGO. The number of bricks used in reduced by applying the notion of graph connectivity. You even get an order list for Bricklink to build the image with LEGO on your own.

I believe the code is on github if you want to star it:


Great project!

This has been done for 3D models as well. https://brickify.it/

The idea was to build most of the model from Lego and 3D-print only the complicated / detailed parts.

For those interested: This is what my wall looks like. https://imgur.com/a/anSU4

I feel like the resolution was more of a problem than the color limitations.

I made a simple browser-based tool like this for Perler beads and crosstitch thread colors: http://www.imjasonh.com/projects/crafty

If you squint at the final result it is really quite good! A fun article :-)

Reminded me of a present my wife got me few ears ago - she resized the image of Dance by Matisse into something close to 80 x 60 pixels, cut off color squares and created pixelated picture ~ 4 on 3 feets.


This could use a POV-Ray render.

I thought this story would be about mobile phones.


If you talk on the mobile phone constantly, it looks like you have a brick earring.

More so in the 80's.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact