Tag Info

New answers tagged

10

You can use ImageTrim to extract the bounding boxes from the image. image = Import["http://i.stack.imgur.com/GjN95.jpg"]; m = MorphologicalComponents@Binarize@ColorNegate@MinFilter[image, 1]; m = SelectComponents[m, "Elongation", # > 0.8 &]; c = ComponentMeasurements[{m, image}, "BoundingBox"]; ImageTrim[image, #] & /@ c[[All, 2]]


6

So basically ImageCapture[] is the hub where you set things which CurrentImage[] adoptes. Run ImageCapture[] and in-interface select the device - it is easier: Then run your code with CurrentImage[] - it will now pick up the external camera. Droste video-feedback effect you see in the images proves I'm not using my laptop camera in all this ;-) - not ...


3

According to an example here:ImageValue, you could use an extension of this perhaps: ImageValue[yourimage, Table[{i, i}, {i, .5, 10, 1}]]; This takes the values of the diagonal pixels in the image and outputs them as a list - you could then interpolate this for your intensity plot. Extending it to an arbitrary line shouldn't be too much of a leap!


9

Edit: I've included the code from Bresenham's line algorithm which is used to get positions of pixels of interest. Also couple of minor improvements added. Looking forward for any sugesstions :) img = ColorConvert[Import["http://newton.umsl.edu/run//nano/5102D120.png"], "Grayscale"] Deploy@With[{opt = Sequence[Frame -> True, ...


4

You could use ImageTransformation: img = ExampleData[{"TestImage", "Lena"}]; line = {{150.`, 406.`}, {271.`, 156.`}}; ImageTransformation[img, line[[1]] + #[[1]]*(line[[2]] - line[[1]]) &, {100, 1}, PlotRange -> {{0, 1}, {0, 1}}, DataRange -> Full] If you want raw pixel values instead of an image, use ImageData[transformResult][[1]], to get ...


5

I think this could be what you're looking for. First let's create a list of patches: img = ExampleData[{"TestImage", "Lena"}]; patches = ImagePartition[img, 256, {128, 128}] I'm not going to use ImageAssemble to put these back together. The trick is to create black and white masks, one for each patch. This is one example: And then to use ImageMultiply ...


2

ip = ImagePartition[ExampleData[{"TestImage", "Lena"}], 40, {10, 10}] ; ImageAssemble[Map[ImageCrop[#, {10, 10}] &, ip, {2}]]


4

Exporting .ico from Mathematica works fine in version 9.0.1. On Mac, the built-in function sips tells me that it only supports image sizes that are a power of 2. So you could try to create the desired file using this: Export["img.ico", img, ImageSize -> {256, 256}] where img is the image to be exported. However, in version 9.0.1 I'm able to export ...


5

There is no built in option, however for the US it's very easy because the coordinates of the state borderlines are all over the Internet. This led me to one such data set. I'll include how I cleaned it up, like this: data = Import["http://econym.org.uk/gmap/states.xml"]; name[{"name" -> n_, ___}] := n coordinates[XMLElement["point", {"lat" -> lat_, ...


2

To answer the question of how to set the point size to precisely one pixel: use AbsolutePointSize[1]. PointSize specifies the point diameter relative to the graphics width. Points whose size is controlled by this directive change size when the graphics is resized. AbsolutePointSize will use printer's points for printable vector graphics (such as PDF) ...


3

data = Flatten[ Table[Table[{i, j} k, {i, 1, 50, .3}, {j, 1, 50, .3}], {k, 1, 10, .3}], 2]; Dimensions@data (*{833776, 2}*) You can also do something like: (here I've assumed that you know what is the range of the data - 500) m = SparseArray[Rule[IntegerPart[#], #2 ] & @@@ Tally[(200. Round[data/500., 1/200.] + 1.)]]; ...



Top 50 recent answers are included