# Tag Info

294

Mathematica, 100%, 141 bytes f@x_:=Count[1>0]@Table[ImageInstanceQ[x,"caprine animal",RecognitionThreshold->i/100],{i,0,50}];If[f@#>f@ImageReflect@#,"Up","Down"]<>"goat"& Well, this feels more than a little like cheating. It's also incredibly slow as well as being very silly. Function f sees roughly how high you can set the Recognition ...

159

Java - GUI with progressive randomized transformation I tried a LOT of things, some of them very complicated, then I finally came back to this relatively-simple code: import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; ...

142

AutoIt, VB Introduction This is an implementation of the Object Removal by Exemplar-Based Inpainting algorithm developed by A. Criminisi, P. Perez (Cambridge Microsoft Research Ltd.) and K. Toyama (Microsoft) [X]. This algorithm is targeted at high-information images (and video frames) and aims to be the balance between structural reconstruction and ...

118

Java import java.awt.Point; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Random; import javax.imageio.ImageIO;...

112

Python + scipy + scikit-image, weighted Poisson disc sampling My solution is rather complex. I do some preprocessing on the image to remove noise and get a mapping how 'interesting' each point is (using a combination of local entropy and edge detection): Then I choose sampling points using Poisson disc sampling with a twist: the distance of the circle is ...

98

C: 3863 1144 1023 999 942 927 The original solution saves 2 pnm files per run (one with g appended, before dithering). Because the dithering wasn't beautiful for the first few lines, there is a hack in place to render more lines than needed, and crop during output. The golfed solution has a simpler dithering and saves only the dithered image. (no warnings ...

97

Perl, with Lab color space and dithering Note: Now I have a C solution too. Uses a similar approach to aditsu's, (choose two random positions, and swap the pixels at those positions if it would make the image more like the target image), with two major improvements: Uses the CIE Lab* color space to compare colors — the Euclidean metric on this space is a ...

79

Python The idea is simple: Every pixel has a point in the 3D RGB space. The goal is matching each a pixel of the source and one of the destination image, preferably they should be 'close' (represent the 'same' colour). Since they can be distributed in pretty different ways, we cannot just match the nearest neighbour. Strategy Let n be an integer (small, 3-...

71

JavaScript, 93.9% var solution = function(imageUrl, settings) { // Settings settings = settings || {}; var colourDifferenceCutoff = settings.colourDifferenceCutoff || 0.1, startX = settings.startX || 55, startY = settings.startY || 53; // Draw the image to the canvas var canvas = document.createElement("canvas"), ...

65

GLSL (+ JavaScript + WebGL) Live demo | GitHub repository How to use Reload the page for a new random image. If you want to feed in a particular seed, open your browser's console and call drawScreen(seed). The console should display the seed used on load. I haven't really tested this on a lot of platforms, so let me know if it doesn't work for you. Of ...

65

C++ My approach is quite slow, but I'm very happy with quality of the results that it gives, particularly with respect to preserving edges. For example, here's Yoshi and the Cornell Box with just 1000 sites each: There are two main parts that make it tick. The first, embodied in the evaluate() function takes a set of candidate site locations, sets the ...

63

Python, 100%, 225 bytes import requests SEARCH = "http://www.bing.com/images/searchbyimage?FORM=IRSBIQ&cbir=sbi&imgurl=" THRESHOLD = 30 url = raw_input() print "Upgoat" if requests.get(SEARCH + url).content.count('img') > THRESHOLD else "Downgoat" Use reverse image search on the goat. If the page returns a satisfiable amount of results, it is ...

59

Java, 93.9% 100% This works by determining the row contrast in the upper and lower part of the image. I assume that the contrast in the bottom half of the image is bigger for 2 reasons: the 4 legs are in the bottom part the background in the upper part will be blurred because it is usually the out-of-focus-area I determine the contrast for each row by ...

58

I've improved my method by adding actual compression. It now operates by iteratively doing the following: Convert the image to YUV Downsize the image preserving the aspect ratio (if the image is color, the chroma is sampled at 1/3 the width & height of the luminance) Reduce the bit depth to 4 bits per sample Apply median prediction to the image, making ...

58

Python 2.7 (with PIL) - No Pseudorandomness I break the image into 2 by 2 blocks (ignoring the remainder) and rotate each block by 180 degrees, then I do the same with 3 by 3 blocks, then 4, etc. up to some parameter BLKSZ. Then I do the same for BLKSZ-1, then BLKSZ-2, all the way back down to 3, then 2. This method reverses itself exactly; the unscramble ...

55

Python, Score: 24 16 This solution, like Falko's one, is based on measuring the "foreground" area and dividing it by the average grain area. In fact, what this program tries to detect is the background, not so much as the foreground. Using the fact that rice grains never touch the image boundary, the program starts by flood-filling white at the top-left ...

55

IDL, adaptive refinement This method is inspired by Adaptive Mesh Refinement from astronomical simulations, and also Subdivision surface. This is the kind of task that IDL prides itself on, which you'll be able to tell by the large number of builtin functions I was able to use. :D I've output some of the intermediates for the black-background yoshi test ...

52

C#, Winform Edit Changing the way you fill the coordinates array you can have different patterns - see below Do you like this kind of pattern? Bonus: Random swap exactly one time all pixels in upper half with all pixels in lower half. Repeat the same procedure for unscrambling (bonus). Code Scramble.cs using System; using System.Collections.Generic; ...

52

C#, 2760 bytes namespace System{class P{static void Main(){var c="us>g System;us>g System.Draw>g;class p{publ' stZ' void c(){var b=(Bitmap)Bitmap.FromFile(Console.ReadL>e());Console.Write(!1,1[3,3#2?!4,4#1?!5,5#2?!@#1?!+$SupK UsK*Salesforce%]^$< F't~_Fantasy%8,8#6?$Arqade*Ask Ubuntu%@#6?$WordPress Development%8,8#4?!9,9#2?$Phys's*UsK ... 48 Python - A theoretically optimal solution I say theoretically optimal because the truly optimal solution is not quite feasible to compute. I start off by describing the theoretical solution, and then explain how I tweaked it to make it computationally feasible in both space and time. I consider the most optimal solution as the one yielding the lowest total ... 47 Python 3 + PIL + SciPy, Fuzzy k-means from collections import defaultdict import itertools import random import time from PIL import Image import numpy as np from scipy.spatial import KDTree, Delaunay INFILE = "planet.jpg" OUTFILE = "voronoi.txt" N = 3000 DEBUG = True # Outputs extra images to see what's happening FEATURE_FILE = "features.png" ... 45 Matlab This is a simple interpolation approach. The idea is first mirroring what is on each side of the patch. Then those mirror image pixels are interpolated by how close they are to the corresponding edge: The tricky part was finding a nice interpolation weights. After some playing around I came up with a rational function that is zero on all edges ... 43 C, arbitrary blurring, easily reversible Late to the party. Here is my entry! This method does a scrambling blur. I call it scramblur. It is extremely simple. In a loop, it chooses a random pixel and then swaps it with a randomly chosen nearby pixel in a toroidal canvas model. You specify the maximum distance defining what "nearby pixel" means (1 means ... 42 Python 3.4 Bonus 1: Self inverse: repeating restores the original image. Optional key image: original image can only be restored by using the same key image again. Bonus 2: Producing pattern in the output: key image is approximated in the scrambled pixels. When bonus 2 is achieved, by using an additional key image, bonus 1 is not lost. The program is still ... 42 Java Jungle (954 golfed) Full of deep, twisting undergrowth, this is a forest not easily traversed. It's basically a fractal random walk with slowly shrinking, twisty vines. I draw 75 of them, gradually changing from white in the back to black up front. Then I dither the whole thing, shamelessly adapting Averroes' code here for that. Golfed: (Just ... 39 Python Edit: Just realized that you can actually sharpen the source with ImageFilter to make the results more well-defined. Rainbow -> Mona Lisa (sharpened Mona Lisa source, Luminance only) Rainbow -> Mona Lisa (non-sharpened source, weighted with Y = 10, I = 10, Q = 0) Mona Lisa -> American Gothic (non-sharpened source, Luminance only) Mona Lisa -> ... 39 C# Winform - Visual Studio 2010 Edit Dithering added. That's my version of random-swap algorithm - @hobbs flavour. I still feel that some sort of non-random dithering can do better... Color elaboration in Y-Cb-Cr space (as in jpeg compression) Two phase elaboration: Copy of pixel from source in luminance order. This already gives a good image, but ... 39 Python 2 with PIL (Gallery) from __future__ import division from PIL import Image import random, math, time from collections import Counter, defaultdict, namedtuple """ Configure settings here """ INFILE = "spheres.png" OUTFILE_STEM = "out" P = 30 N = 300 OUTPUT_ALL = True # Whether to output the image at each step FLOOD_FILL_TOLERANCE = 10 ... 38 Python 3, 91.6% -edited with the new test cases set filename to the goat picture you wish to test. It uses a kernel to make an image top/bottom asymmetric.I tried the sobel operator, but this was better. from PIL import Image, ImageFilter import statistics k=(2,2,2,0,0,0,-2,-2,-2) filename='0.png' im=Image.open(filename) im=im.filter(ImageFilter.Kernel((3,... 37 Go Works by dividing the image into regions recursively. I try to divide regions with high information content, and pick the dividing line to maximize the difference in color between the two regions. Each division is encoded using a few bits to encode the dividing line. Each leaf region is encoded as a single color. 4vN!IF$+fP0~\}:0d4a's%-~@[Q(qSd<&...

Only top voted, non community-wiki answers of a minimum length are eligible