Generating images with Markov chains - take two!
I was pretty disappointed with the result of the first take. The first version’s implementation was basically:
Read in all pixels of the source image. Record the color frequency of the pixel’s right neighbor. Pick a random color from the source input, plot it at 0,0. From that color, get the next color from the frequency data (there can be several possibilities here, pick one “randomly” wheighted by frequency). Plot the next one at 1,0.. rinse and repeat until the whole screen/window is full.
Not surprisingy the results were very one dimensional. And varied very little in charcteristics.
This new version records every pixels surrounding neighbors (left, right, top, bottom), and uses that data to plot. Unfortunately it wasn’t much better, all images come out as sort of marble-like textures. It’s not bad, but I hoped for more interesting results. I’ve left out the source images intentionally, since they don’t have much impact on the result besides color.
Combining several source images is easy, and one such result can be seen here in image 2.
So how could I improve on this further? I think color alone won’t do. I need to also take position into account somehow. Maybe something to think about and try to hack next weekend.
Markov generated pictures (scaled up) with the mustache mona lisa as input.
- lein new compojure myproject
- lein ring server
- Populate the “database”: curl -X PUT localhost:3000/foo/something/45
- Get stuff: curl localhost:3000/foo/something
- Same as above: curl localhost:3000/something
I’m interested in doing some development for mobile phones. Naturally I’d like my endeavors to have the possibility to reach the largest possible audience - iOS and Android. But I’d also like to exercise my Clojure skills. What are my possibilities here?
I’ve googled a bit without finding very much. I found a post on Vinod Kurup’s blog about Clojurescript + PhoneGap which is interesting, but it’s from 2011. For Titanium it’s even worse, I could only find a gist by jolby with a toy example.
Anyone know where to look for better sample code or information? Is there something else besides PhoneGap or Titanium that I should look for?
schema - Clojure(Script) library for declarative data description and validation
A less formal (and only provides runtime checks) alternative to core.typed.
What a great course! I thought it was perhaps going to be a bit too easy, but I was pleasantly surprised. The level was spot on for what I wanted. A thorough introduction to Scala and functional principles, with some pretty tricky programming assignments.
I think Scala is the best introduction for anyone who wants to get into functional programming to be honest. My first contact with functional programming was Haskell - a rough, albeit rewarding, ride. After that I looked at Clojure. Also not very beginner friendly IMO, mostly due to its Lisp nature (prefix notation etc). Elixir is slightly better in that regard (still a bit young), but Scala takes the prize - no doubt.
Help build optional type systems for Clojure and Clojurescript.
Qritch, Clojure+Quil 2013.
Playing with data.generators, noise and basic trig.
Clojure has some excellent related tools. Today was the first time I used clojure.data.generators (“Generators for random Clojure data.”). Just pop
[org.clojure/data.generators "0.1.2"] into your Leiningen project.clj. Very straight-forward and intuitive to use so far. You can easily get primitives and control aspects of the generation.
A very simple example that generates a number between 0 and 255:
(defn color 
(gen/uniform 0 255))
Second in a series. Part 1.
First in a series. Code will come as well.
(:require [speclj.core :refer :all]
[sample.core :refer :all]))
(it "is true" (should true))
(it "is not false" (should-not false)))