Tag Info

New answers tagged

5

Here's another approach that uses some of the built-in morphological (image processing) functions. Begin by reading in the figure, detecting the edges, and then making them thick: i = Import["http://dailycoffeenews.com/wp-content/uploads/2011/09/disposable-coffee-cup.jpeg"]; fat = Dilation[EdgeDetect[i], 20] Get just the outline of the cup: thin = ...


10

Too late and not so general as @Nikie but I will still like to answer in order to highlight a method involving generalized Eigen values! Lets take the image. img = Import["http://i.stack.imgur.com/H63BK.jpg"]; (* Detecting ellipsoidal edges and removing the straight line component *) i = ImageSubtract @@ {EdgeDetect[img, 10],EdgeDetect[img, 10, ...


22

Basically, you want to fit a shape to a set of points with outliers. One common algorithm to do this is RANSAC (random sample consensus). The basic outline of this algorithm is: Select N points at random (where N is the minimum number of points required for fitting the shape, i.e. 2 for a line, 3 for a circle and so on) Fit the shape to these points Repeat ...


6

This didn't work as well as I'd hoped, but it's quite interesting to see what went wrong. i = Import["http://dailycoffeenews.com/wp-content/uploads/2011/09/disposable-coffee-cup.jpeg"]; j = ColorConvert[i, "GrayScale"]; k = Thinning[ DeleteBorderComponents[ DeleteSmallComponents[ Opening[ Dilation[ ...


12

I don't think you can control the interpolation used by Texture. One option might be to embed the image as a Raster primitive instead. Show[ParametricPlot[{20 + 1.4 x - 40 y, x}, {x, 0, 200}, {y, 0, 1}, BoundaryStyle -> Directive[Purple, Thick], PlotRange -> {{0, 201}, {0, 144}}, Prolog -> {Raster @ Reverse @ ImageData @ a}]] Zoomed ...


4

Using a combination of nearest resampling and a large size (e.g. 2000 pixels) should do the trick. a = ImageResize[Import["http://i.imgur.com/PiLKV6S.png"], {2000}, Resampling -> "Nearest"]; Show[ParametricPlot[{20 + 1.4 x - 40 y, x}, {x, 0, 200}, {y, 0, 1}, BoundaryStyle -> Directive[Purple, Thick], PlotRange -> {{0, 201}, {0, 144}}, Prolog ...


5

Not too hard. a = Image[Table[If[EvenQ[x + y], 1, 0], {x, 50}, {y, 50}], ImageSize -> Large]; Graphics[{Texture[a], Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}, VertexTextureCoordinates -> {{1, 0}, {0.5, 1}, {0, 0}}]}]


3

Lets do an exercise importing and exporting JPEG data. First let's create a tiny single pixel JPEG file: In[1]:= Export["~/Desktop/minitest.jpg", Image[{{0}}]] Now lets import the binary data that we have just created: In[2]:= Import["/Users/gdelfino/Desktop/minitest.jpg", "Binary"] Out[2]:= {255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 1, 1, 0, 72, ...


3

Your binarydata seems to be a string with hexadecimal digits. Converting this using FromCharacterCode yields nonsense, of course. It can be solved in a few steps: 0) The string: imageString = "FFD8FFE000104A46494600010201006000600000FFEE000E41646F6265006400000\ 00001FFE1135D4578696600004D4D002A0000000800070132000200000014000000620\ ...


5

Setting img to the result of downloading and importing your image, img = Import["http://i.stack.imgur.com/ZObmf.jpg"] rasImg = Rasterize[img, RasterSize -> 100]; edges4 = EdgeDetect[rasImg, 2, 0.030, "StraightEdges" -> 0.14] imgLines4Sep1 = ImageLines[edges4, 0.05, 0.01]; Graphics[Line /@ imgLines4Sep1] yields a picture featuring at least some ...


8

Also worth noting is that there's a companion function to ImageValue, called PixelValue. The difference between the two is, as far as I can tell from the documentation, that ImageValue interpolates the color of a coordinate according to the colors of nearby pixels, whereas PixelValue finds the color of the pixel whose centre is nearest to the integer values ...


10

tp = ExampleData[{"TestImage", "Lena"}]; Manipulate[Column @ {tp, ImageValue[tp, p]}, {{p, {1, 1}}, Locator}]


9

As a side-note - you can quickly get color info from images using image assistant. Just click once on the image and in version 9 assistant will appear below:


10

For example: tp = ExampleData[{"TestImage", "Airplane"}]; Manipulate[Column@{tp, Extract[ImageData[tp], Round /@ p]}, {{p, {1, 1}}, Locator}]


0

Everybody seems happy already at the time of this answer. But the following resources will help a newcomer develop good habits: Volume Rendering And Processing Image3D (esp. the section Details and Options)



Top 50 recent answers are included