Re: Re: overimpose graphics on an imported image
- To: mathgroup at smc.vnet.net
- Subject: [mg106267] Re: [mg106232] Re: overimpose graphics on an imported image
- From: "van der Burgt, Maarten" <Maarten.VanDerBurgt at icos.be>
- Date: Thu, 7 Jan 2010 02:27:50 -0500 (EST)
- References: <201001011037.FAA05346@smc.vnet.net> <hhn5mk$75g$1@smc.vnet.net> <201001050649.BAA24279@smc.vnet.net>
Alessandro, A bit more straightforward is the following: img = Import["http://sipi.usc.edu/database/misc/5.1.12.tiff"]; {nx, ny} = ImageDimensions[img]; Show[{Rasterize[img], Graphics@{Red, Opacity[0.5], Disk[{nx/3, 2 ny/3}, 35]}}] Using the Rasterize command the image is converted to Graphics first. (Thank to Mariusz Jankowski) regards, Maarten -----Original Message----- From: alexxx.magni at gmail.com [mailto:alexxx.magni at gmail.com] Sent: Tuesday, 05 January, 2010 07:50 To: mathgroup at smc.vnet.net Subject: [mg106267] [mg106232] Re: overimpose graphics on an imported image thank you for your help! It works, although it needs this further refinement: ImageCompose[i1, {Graphics[{Red, Rectangle[{xmin, ny - ymin}, {xmax, ny - ymax}]}, PlotRange -> {{0, nx}, {0, ny}}], 0.5}] if I want to be consistent with coordinates given in other Mathematica functions (e.g. ImageTake[i1, {ymin, ymax}, {xmin, xmax}] which I use on the same image...) I just would like the coordinates were less confusing in M ! alessandro On 2 Gen, 11:04, Patrick Scheibe <psche... at trm.uni-leipzig.de> wrote: > Hi, > > tell Mathematica about your plotting-range: > > img = Import["http://sipi.usc.edu/database/misc/5.1.12.tiff"]; > {nx, ny} = ImageDimensions[img]; > ImageCompose[img, {Graphics[{Red, Rectangle[{0, 0}, {nx/2, ny/2}]}, > PlotRange -> {{0, nx}, {0, ny}}], 0.5}] > > Cheers > Patrick > > On Fri, 2010-01-01 at 05:37 -0500, alexxx.ma... at gmail.com wrote: > > hi people, > > I wonder if it is just me being dumb, but I'm unable to perform what I > > thought was a very simple operation: > > > having imported an image of (Lx,Ly) pixels, draw above it an empty > > rectangle at coordinates (x0,y0) (x1,y1) (say, lower left and upper > > right corners). > > > Say for example that I want to overimpose on image i1 a rectangle > > covering a 10% portion, if I use this: > > > ImageCompose[i1, Graphics[Rectangle[{0, 0}, {0.1*Lx, 0.1*Ly}]]] > > > I have (apart from a filled rectangle instead of empty, but I can deal > > with it later) > > a huge rectangle covering all of it! > > How these coordinates interact? > > > Thanks for any help... > > > Alessandro Magni
- References:
- overimpose graphics on an imported image
- From: "alexxx.magni@gmail.com" <alexxx.magni@gmail.com>
- Re: overimpose graphics on an imported image
- From: "alexxx.magni@gmail.com" <alexxx.magni@gmail.com>
- overimpose graphics on an imported image