MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Drawing on top of the image

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85206] Re: Drawing on top of the image
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 2 Feb 2008 03:24:09 -0500 (EST)
  • References: <fnuhlu$9vg$1@smc.vnet.net>

Hi,

what is with

img = Import[
   "http://www.informatik.uni-ulm.de/ni/Lehre/WS01/CV2/bilder/lena.\
tif"];

ipgray = ListInterpolation[img[[1, 1]]];
grayData[p1_, p2_] := Module[{rMax, t},
   rMax = Sqrt[#.#] &[p1 - p2];
   Table[{t*rMax, ipgray @@ (p1*(1 - t) + p2*t)}, {t, 0, 1, 1/rMax}] //
     N
   ]

and

Manipulate[
  DynamicModule[{dta, xr, yr, ny, nx, orig},
   {ny, nx} = Dimensions[img[[1, 1]]];
   {xr, yr} = Transpose[{p1, p2}];
   xr = Min[Max[#, 1], nx]  & /@ xr;
   yr = Min[Max[#, 1], ny]  & /@ yr;
   {p1, p2} = Transpose[{xr, yr}];
   dta = grayData[p1, p2];
   orig = dta[[1, 1]];
   dta = # - orig & /@ dta;
   Graphics[
    {img[[1]], {RGBColor[1, 0, 0], Line[{p1, p2}]},
     {RGBColor[0, 1, 0],
      GeometricTransformation[Line[dta],
       AffineTransform[{RotationMatrix[ArcTan @@ (p2 - p1)], p1}]]}}
    ]]
  , {{p1, {1, 1}}, Locator}, {{p2, {64, 64}}, Locator}
  ]

??
Regards
   Jens

=8Aer=FDch Jakub wrote:
> Does anybody have an idea, how to draw (lines) on top of the photo, whi=
ch I
> import?
>
> Exactly what I need is:
> image = Import["something.jpg"]
> imageData = Import["something.jpg",{"JPEG","GrayLevels"}]
>
> Now I want to "slice" (with line) the image and work with the imageData=
 on
> the "cut".
> 
> The question is, how to display the image together with the slicing lin=
e.
>
> Thanks for any hint
>
> Jakub
>


  • Prev by Date: Re: Convex random polyhedrons
  • Next by Date: Re: Using "Limit" when the limit is a delta function
  • Previous by thread: RE: Drawing on top of the image
  • Next by thread: Re: Drawing on top of the image