Tag Info

Hot answers tagged

18

A somewhat revised approach. First define the colours and create column images from them. There are four block colours and one striped. blue = {0.15, 0.23, 0.33}; red = {0.77, 0.16, 0.17}; paleblue = {0.50, 0.60, 0.63}; beige = {0.96, 0.90, 0.69}; cols = Image[Table[Transpose[{##}], {60}] ~Flatten~ 1] & /@ {{blue}, {red}, {paleblue}, {paleblue, ...


17

@Simon Woods points out in a comment that: In fact the delay on the initial run is caused by compiling code to provide the Poisson distribution :-) You can look at ImageColorOperationsDumpiImageEffectPoissonNoise to see how it works internally. Now, although PoissonDistribution can't be compiled, there's nothing stopping the use of my own C++ ...


16

Here's my attempt, using @RahulNarain ColorFunction with different colors: obamaize[image_, text_] := Module[{colored = Colorize[image, ColorFunction -> (Piecewise[{{RGBColor[{30, 60, 88}/255], # < 0.5}, {RGBColor[{202,36, 40}/255], # < 0.67}, {RGBColor[{124, 151, 168}/255], # < 0.75}, {RGBColor[{240, 232, 173}/255], True}}] ...


10

Here's how you might approach your problem using direct manipulation of pixel data. First create your graphics: InsertImage = DensityPlot[Sqrt[1 - x^2 - y^2], {x, -1, 1}, {y, -1, 1}, Frame -> False, ColorFunction -> (Opacity[Max[Re[#], 0], GrayLevel[Max[Re[#], 0]]] &), ImageSize -> 20, Background -> Opacity[0, Black]] Now rasterize ...


9

Here's a first (very simple!) attempt: {p1, p2} = ColorConvert[Import[#], "Grayscale"] & /@ {"http://i.stack.imgur.com/2hf7N.jpg", "http://i.stack.imgur.com/WnVtF.jpg"}; A simple CorrelationDistance gives a surprisingly good estimate for the shift: corr = ImageCorrelate[p1, ImageReflect[p2, Left -> Right], CorrelationDistance] ...


9

Just for the sake of the argument: Your approach needs about 3.2 seconds for 200 insertions on my machine. Consider this {alpha, col} = Transpose[ Table[{Boole[Im[#] == 0], Max[Re[#], 0]} &@Sqrt[1 - x^2 - y^2], {x, -1, 1, 2/33.}, {y, -1, 1, 2/33.}], {2, 3, 1}]; inset = SetAlphaChannel[Image[col], Image[alpha]]; spiral = Table[{256, 256} + ...


6

First off, here's @kale's excellent answer modified with a bilateral filter to smooth it a little: kalesObamaize[image_, text_] := Module[{colored = Colorize[BilateralFilter[image, 2, 0.5], ColorFunction -> (Piecewise[{{RGBColor[{30, 60, 88}/255], # < 0.5}, {RGBColor[{202, 36, 40}/255], # < 0.67}, ...


4

Here is an example returning 9 lines without additional points: i = Import["http://goo.gl/5R4MAl"]; ii = Closing[Binarize[GradientFilter[ColorNegate@Binarize[i, .55], 2], 0.1], 1]; foo = Select[ImageLines[ii, Segmented -> True], EuclideanDistance @@ #[[1]] > 100 &]; Show[i, Graphics[{Thick, Orange, Line /@ foo}]] Here are the details for foo: ...


4

shape1 := Graphics[{#, Circle[{0, 0}, 1.5], Disk[]}, ImageSize -> 10] &; shape2 := Graphics[{Lighter@#, Disk[]}, ImageSize -> 10] &; ClearAll[lOF]; lOF[nOfOverlays_, colors_List, opts : OptionsPattern[]] := DynamicModule[{layer = 1, pts = ConstantArray[{{100, 100}, {700, 700}}, nOfOverlays], col = ...


4

This is a followup to @Simon Woods' answer and @rm -rf's comment Now if only there was a way to fix that hatch from bleeding into the bg... There is! Let's create a face mask: i = Import["wolfram.jpg"]; face = FindFaces[i][[1]]; facemask = Graphics[{White, Circle[Mean[face], (Mean[face] - face[[1]])*{.8, 1.2}]}, Background -> Black, ...


3

Here a different approach, that mainly uses the build in ImageEffect "Posterization" and ColorReplace: First the image is imported, the background removed and blured a bit: img1=Blur@*RemoveBackground@Import["http://hplussummit.com/images/wolfram.jpg"]; Than the ImageEffect is applied: img2=ImageEffect[img1,{"Posterization",2}]; The dominant colors are ...


3

This should solve the problem: ImagePad[ImagePerspectiveTransformation[i2, Round[f[[2]][[1]]], DataRange -> Full], -BorderDimensions[ ImagePerspectiveTransformation[i2, Round[f[[2]][[1]]], DataRange -> Full]]]


3

Using Rahul's idea and a bit of blurring: img = Import["http://hplussummit.com/images/wolfram.jpg"]; bimg = Blur[img]; Colorize[ bimg, ColorFunction -> (Piecewise[{{Darker@Blue, # < 0.5}, {Red, # < 0.67}, {Darker@LightBlue, # < 0.75}, {LightYellow, True}}] &)]


3

Here one approach: im=Import["http://hplussummit.com/images/wolfram.jpg"]; mb=MorphologicalBinarize[im]; cb=ChanVeseBinarize[im]; ia1=ImageAdd[ColorReplace[im,ColorNegate[mb]->Darker@Blue],mb]; ia2=ImageAdd[ColorReplace[RemoveBackground[im],ColorNegate[cb]->Darker@Red],cb]; ...


3

According to the documentation the coordinate system used by ImageTransformation uses $(w,h)=(1,\alpha)$ where $\alpha$ is the aspect ratio. I'll use an image with aspect ratio 1: img = ExampleData[{"TestImage", "Lena"}]; aspectRatio = Divide @@ ImageDimensions[img] (* Out: 1 *) In order to translate the image we can move each pixel 25% downwards and to ...


2

With SelectComponents you can do it like this: selectBorder[border_] := SelectComponents[ m, "AdjacentBorders", MemberQ[#, border] & ] So that selectBorder /@ {Left, Right, Top, Bottom} gives But there's a problem, as you can see. AdjacentBorder doesn't count elements that don't touch their borders. So a harder question is not how you can ...


2

You can use for example ImageSubtract as follow: j = Import@"http://i.imgur.com/AC0bvkG.png"; k = Binarize[j, FindThreshold[j]]; l = SelectComponents[k, "FilledCircularity", -7]; m = ImageCrop[l]; comp = ComponentMeasurements[m, {"AdjacentBorders", "BoundingBox"}] /. {{_, Right} | {Right, _} -> {Right}, {_, Left} | {Left, _} -> {Left}}; imgdim ...



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