Prev: Find-Replace using an evaluated expression
Next: When can Mathematica have a decent Find dialogue?
From: Francisco Javier Chávez Contreras on 13 Feb 2010 05:24 Good Evening: I have a PNG image from a chart (curves), and i need to insert into it two lines of cyan color. These lines have to be moved into the PNG using two Sliders (one for the vertical line, and other for the horizontal line). I created the Slider using the "Control" function, because provide me the option for enter the values or "slide" a value. I created both cyan lines and saved into a variable, but i cant superpose these lines and move them. Can anyone of you help me "math friends"? Sorry my english! Cheers, Francisco Ch=E1vez C. Santiago, Chile.
From: Bob Hanlon on 14 Feb 2010 05:57 $Version 7.0 for Mac OS X x86 (64-bit) (February 19, 2009) plt = Plot[x^Range[3], {x, 0, 1}]; Export["plt.png", plt]; png = Rasterize[Import["plt.png"]]; With[{ xmin = 16.5, xmax = 351, ymin = 15, ymax = 222.5}, Manipulate[ Show[ png, Graphics[{Cyan, Thick, Line[{{x (xmax - xmin) + xmin, ymin}, {x (xmax - xmin) + xmin, ymax}}], Line[{{xmin, y (ymax - ymin) + ymin}, {xmax, y (ymax - ymin) + ymin}}]}]], {{x, 0.50}, 0., 1., 0.01, Appearance -> "Labeled"}, {{y, 0.50}, 0., 1., 0.01, Appearance -> "Labeled"}, ControlType -> {Slider, VerticalSlider}, ControlPlacement -> {Top, Left}]] The labels on the sliders are editable. They can be selected and modified. Then click in the frame to "enter"the value and cause the slider to move to the entered value. Although on my system, the initial evaluation causes an error -- pink box over the output ("The specified setting for the option InputFieldBoxOptions, Appearance cannot be used."), moving either slider resolves this. Bob Hanlon ---- "Francisco Javier Ch=C3=A1vez Contreras" <francisco.chavez(a)usach.cl> wrote: ============= Good Evening: I have a PNG image from a chart (curves), and i need to insert into it two lines of cyan color. These lines have to be moved into the PNG using two Sliders (one for the vertical line, and other for the horizontal line). I created the Slider using the "Control" function, because provide me the option for enter the values or "slide" a value. I created both cyan lines and saved into a variable, but i cant superpose these lines and move them. Can anyone of you help me "math friends"? Sorry my english! Cheers, Francisco Ch=E1vez C. Santiago, Chile.
From: Patrick Scheibe on 14 Feb 2010 05:58 Hi, you could do it with ImageCompose. Just overlay your Image with the lines you want to have: SetAttributes[lines, HoldRest]; lines[img_Image, output_] := DynamicModule[ {nx, ny, h, v}, {nx, ny} = ImageDimensions[img]; Column[{ Dynamic[ output = ImageCompose[img, Graphics[{Cyan, Thick, Line[{{1, h}, {nx, h}}], Line[{{v, 1}, {v, ny}}]}, PlotRange -> {{1, nx}, {1, ny}}]]], Slider[Dynamic[h], {1, ny}], Slider[Dynamic[v], {1, nx}] }] ]; lines[Import["http://sipi.usc.edu/database/misc/4.1.04.tiff"], outimg] your final image is stored in the variable "outimg" here. Cheers Patrick On Sat, 2010-02-13 at 05:24 -0500, Francisco Javier Chávez Contreras wrote: > Good Evening: > > I have a PNG image from a chart (curves), and i need to insert into it two > lines of cyan color. These lines have to be moved into the PNG using two > Sliders (one for the vertical line, and other for the horizontal line). > > I created the Slider using the "Control" function, because provide me the > option for enter the values or "slide" a value. > > I created both cyan lines and saved into a variable, but i cant superpose > these lines and move them. > > Can anyone of you help me "math friends"? > > Sorry my english! > > > Cheers, > Francisco Ch=E1vez C. > Santiago, Chile. > >
From: Francisco Javier Chávez Contreras on 14 Feb 2010 05:58 Hello Patrick, really thanks for your help. I replaced the "img" with my chart and the "Slider" with "Control[{h, 1, ny, Appearance -> "Open"}]" and works perfectly! :] I apreciate your help, thank you very much. Cheers, Francisco Chavez C. El 13 de febrero de 2010 09:33, Patrick Scheibe <pscheibe(a)trm.uni-leipzig.d= e > escribi=F3: > Hi, > > you could do it with ImageCompose. Just overlay your Image with the > lines you want to have: > > SetAttributes[lines, HoldRest]; > lines[img_Image, output_] := DynamicModule[ > {nx, ny, h, v}, > {nx, ny} = ImageDimensions[img]; > Column[{ > Dynamic[ > output = > ImageCompose[img, > Graphics[{Cyan, Thick, Line[{{1, h}, {nx, h}}], > Line[{{v, 1}, {v, ny}}]}, PlotRange -> {{1, nx}, {1, ny}}]]], > Slider[Dynamic[h], {1, ny}], > Slider[Dynamic[v], {1, nx}] > }] > ]; > > lines[Import["http://sipi.usc.edu/database/misc/4.1.04.tiff"], outimg] > > > your final image is stored in the variable "outimg" here. > > Cheers > Patrick > > On Sat, 2010-02-13 at 05:24 -0500, Francisco Javier Ch=E1vez Contreras > wrote: > > Good Evening: > > > > I have a PNG image from a chart (curves), and i need to insert into it > two > > lines of cyan color. These lines have to be moved into the PNG using tw= o > > Sliders (one for the vertical line, and other for the horizontal line). > > > > I created the Slider using the "Control" function, because provide me t= he > > option for enter the values or "slide" a value. > > > > I created both cyan lines and saved into a variable, but i cant superpo= se > > these lines and move them. > > > > Can anyone of you help me "math friends"? > > > > Sorry my english! > > > > > > Cheers, > > Francisco Ch=E1vez C. > > Santiago, Chile. > > > > > >
|
Pages: 1 Prev: Find-Replace using an evaluated expression Next: When can Mathematica have a decent Find dialogue? |