Tag Info

New answers tagged

0

Try something like: imageFileNameList={"1.jpg","2.jpg"}; imageList=(Import[#]&)/@imageFileNameList The format you used, the Import function was expecting a String and found a List. Be sure to include the path to the files as well.


0

Thank you for your help. I have come up with something that is almost what I am looking for: Photo = RandomReal[1, {50, 50}]; Manipulate[ ArrayPlot[Photo, ColorRules -> {y_ /; y < a -> Purple, y_ /; y < b -> Red, y_ /; y < c -> Blue}], {a, 0, 1}, {b, 0, 1}, {c, 0, 1}] What I would like to do is instead of using ArrayPlot ...


0

How about using ChartElements instead of ChartLabels. images = ExampleData[{"TestImage", #}] & /@ {"Lena", "Mandrill"}; BarChart[{{1, 2, 3}, {4, 5, 6}}, ChartElements -> {images, None}]


4

Here is something 1000 x faster. Usage colorF ~ createColorFunction ~ {"TemperatureMap", "AvocadoColors"}; pic = Image@ConstantArray[Range[0, 1, .001], 100] Colorize[pic, ColorFunction -> colorF] It is quite general, you can use arbitrary set of schemes: colorF ~ createColorFunction ~ {"AlpineColors", "AvocadoColors", ...


3

You can use Colorize for this Colorize[RandomImage[1, {10, 10}], ColorFunction -> (Piecewise[ {{ColorData["AlpineColors"][#], 0 < # < .5}, {ColorData["SouthwestColors"][#], .5 < # < 1}}] &)]


2

One approach: ImageApply[ List @@ Piecewise[{ {ColorData["AlpineColors"][2 #], 0 < # < .5}, {ColorData["SouthwestColors"][2 # - 1 ], .5 < # < 1} }] &, Image[RandomReal[1, {10, 10}]]] or Image[Map[ List @@ Piecewise[{ {ColorData["AlpineColors"][2 #], 0 < # < .5}, ...


2

After you draw one or more selection rectangles and click away from the image they are still there suspended in a xenon mist but they are only visible if you look dead ahead use the selection tool. We can extract that data from the underlying Cell expression with this Button: Button["Copy ImageMarkers", Cases[ NotebookRead[SelectedNotebook[]], ...


3

data = RandomInteger[1, {300, 300}]; Image[data] or Graphics[Raster[data]] You can also try: ArrayPlot[data] RandomImage[BernoulliDistribution[1/2], {300, 300}] etc.


1

ListDensityPlot[Table[RandomInteger[{0, 1}], {100}, {100}], InterpolationOrder -> 0, ColorFunction -> GrayLevel]


0

You can achieve almost the same thing by saving coordinates. Place an image in Mathematica, click on it, and choose the "coordinates tool" form the little popup menu. Click on as many points as you want (say the upper left and lower right of a bounding box, if that's what you want). When done, choose "copy coordinates". Then paste them into a list.


5

This is not an area I am familiar with but for fun here is approximation of the average thickness of annular region. This uses a lot version 10 functionality. Importing the image: img = Import["http://i.stack.imgur.com/7BQEI.jpg"] Using coordinate tools to calibrate image (cal is collected end points of ruler): cal = {{1000.`, 9.333333333333314`}, ...


9

The key idea to make this simpler is to apply a polar transform: img = Import["http://i.stack.imgur.com/Y6oab.gif"]; center = 0.5 ImageDimensions[img]; maxR = 200; polarToCart = center + {Cos[#[[1]]], Sin[#[[1]]]}*#[[2]] &; polar = ImageTransformation[Binarize[img], polarToCart, {360, maxR}, PlotRange -> {{0, 2 \[Pi]}, {0, maxR}}, DataRange ...


3

Use the fourth parameter of Inset: f = Sin[#] + 5 &; image = ExampleData[{"TestImage", "Lena"}]; Animate[Plot[{f[z]}, {z, 0, 50}, PlotRange -> {{0, 50}, {0, 10}}, Epilog -> Inset[image, {x, f[x]}, Automatic, 10]], {x, 0, 30}]


3

im = ExampleData[{"TestImage", "Aerial"}]; Colorize[im, ColorFunction -> "AvocadoColors"] // Timing // First (* 0.093750 *) versus ImageApply[List @@ ColorData["AvocadoColors"][#] &, im] // Timing // First (* 0.265625 *) ImageApply[List @@ Blend["AvocadoColors", #] &, im] // Timing // First (thanks: @Kuba *) (* 0.109375 *) For a larger ...


2

Raster will be helpful, as it has the ColorFunction option and it can be directly converted back to an Image. Let img be a grayscale image: img = ColorConvert[ExampleData[{"TestImage", "Lena"}], "Grayscale"] Image@Raster[ImageData[img, DataReversed -> True], ColorFunction -> "Rainbow"]


3

This is a quite handy approach of encoding Mathematica-expressions, even complete notebooks, as grayscaled images, which can be posted as PNG-files (and decoded afterwards). Code for encoding and decoding is as follows: (* general encoding to grayscale data *) seEncode[expr_] := Block[{cc = ToCharacterCode[Compress[expr]], olen, a}, olen = ...


0

Although this may not be the best answer, it seems to work for me. Since I don't want to change the permissions of the existing directory to allow Mathematica to write to it, but I want to be able to have those files accessible from that directory, I am making a symbolic (soft) link between the directory in /home/pi/ to the target directory by doing the ...


6

Let's start with an example set everyone (at least everyone with a recent Mathematica version) should be able to use: frames = Image /@ ExampleData[{"TestAnimation", "ToyVehicles"}][[1, 1, All, 2]] Start with an interesting point and follow that. To get a point, just select an image, press . and select your point and copy its coordinates using ctrl+c. In ...



Top 50 recent answers are included