![]() ![]() Within the matrix to each image pixel three numbers are associated: To do so we read the image file and convert it into a three multidimensional matrix. ![]() This first step involves transforming the image into an abstract object on which we can apply statistical learning. Reading a picture into the RGB colourspace – take a picture – convert into a three-dimensional RGB matrix – apply kmeans algo on it and draw a sample of representative colours – move to HSV colour space – remove too bright and too dark colours leveraging HSV colour system properties – further sample colours to select the most “distant” ones. The main idea behind paletteR code is quite simple: Here it is the code (you can donwload the picture from wikicommons visiting ):Ĭreate_palette(image_path = "~/Desktop/410px-Piero_della_Francesca_046.jpg",Īs you see the palette drawn contains all the most representative colours, like the red of the carpets or the wonderful blue of San Giovanni Battista on the left of the painting. – pass the full path to the image through the _image_path_ arg – specify tcolorser of colours we want to draw specifying the _number_of_colours_ attribute – make clear if we need a palette for quantitative or qualitative variables, using the _type_of_variable_ arg. Install_github("andreacirilloac/paletter") ![]() Since paletteR is available only trough Github we have to install it using devtools: Let’s try to apply it on the “Vergine con il Bambino, angeli e Santi” before looking into its functional specification. The package extracts a custom number of representative colours from the image. PaletteR is a lean R package which lets you draw from any custom image an optimized palette of colours. This is where Paletter comes from: bring the Renaissance wisdom and beauty within the plots we produce every day. While I was looking at the painting I started, wondering how we moved from this wisdom to the ugly charts you can easily find within today’s corporate reports ( find a great sample on the WTF visualization website) If you see this painting you will find a profound of colours with a great equilibrium between different hues, the hardy usage of complementary colours and the ability expressed in the “chiaroscuro” technique. During my visit I was particularly impressed from one of them: “La Vergine con il Bambino, angeli e Santi”, by Piero della Francesca. This museum is full of incredible paintings from the Renaissance period. During a lunch break I was visiting the Pinacoteca di Brera, a 200 centuries old museum. I live in Italy, and more precisely in Milan, a city known for fashion and design events. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |