Skip to main content
Commonmark migration
Source Link
  1. Evaluate the function with some image as a variable.

  2. Set the image size, the polygon color, and the boundary thickness.

  3. Succesively pressing Alt+Click set the locators (having appearance of circles). Adjust the locators, if necessary. Adjust the colors, opacity and the boundary thickness.

  4. Press the button "Pick up the stroked Area". Done.

  5. Call the variable graphicsPolygon, where necessary

    Here is this function:

Here is this function:

  1. Evaluate the function with some image as a variable.

  2. Set the image size, the polygon color, and the boundary thickness.

  3. Succesively pressing Alt+Click set the locators (having appearance of circles). Adjust the locators, if necessary. Adjust the colors, opacity and the boundary thickness.

  4. Press the button "Pick up the stroked Area". Done.

  5. Call the variable graphicsPolygon, where necessary

Here is this function:

  1. Evaluate the function with some image as a variable.

  2. Set the image size, the polygon color, and the boundary thickness.

  3. Succesively pressing Alt+Click set the locators (having appearance of circles). Adjust the locators, if necessary. Adjust the colors, opacity and the boundary thickness.

  4. Press the button "Pick up the stroked Area". Done.

  5. Call the variable graphicsPolygon, where necessary

    Here is this function:

added 1 character in body
Source Link
Alexei Boulbitch
  • 39.6k
  • 2
  • 47
  • 98

I can offer a very simple way of copying any image element as a polygon, that canaftercan after that be used as an element of any graphics or art work done within Mathematica. It is based on the function entitled "strokeArea".

I can offer a very simple way of copying any image element as a polygon, that canafter that be used as an element of any graphics or art work done within Mathematica. It is based on the function entitled "strokeArea".

I can offer a very simple way of copying any image element as a polygon, that can after that be used as an element of any graphics or art work done within Mathematica. It is based on the function entitled "strokeArea".

added 164 characters in body
Source Link
Alexei Boulbitch
  • 39.6k
  • 2
  • 47
  • 98

Clear[strokeArea];

Clear[strokeArea];
strokeArea[image_] := 

  Manipulate[
   DynamicModule[{pts = {}},
 
     Column[{
  
           Dynamic@LocatorPane[Dynamic[pts],
    Dynamic@
     Show[{image, 
       Graphics[{color, EdgeForm[{color, Thickness[thickness]}], 
         Opacity[opacity], Polygon[pts]}]
                             }, ImageSize -> imageSize], 
    LocatorAutoCreate -> True, 
    Appearance -> 
     Graphics[{{color, Thickness[thickness], 
        Circle[{0, 0}, 0.5]}}, ImageSize -> 10]
                                          ],
  Button["Pick up the stroked Area",
   Clear[graphicsPolygon];
   graphicsPolygon = 
    Graphics[{color, EdgeForm[{color, Thickness[thickness]}], 
      Opacity[opacity], Thickness[thickness], Polygon[pts]}];
   ]
  }]
], Row[{Control[{{thickness, 0.005}, 0, 0.015}], Spacer[15], 
 Control[{color, Red}]}], Column[{
 Control[{{imageSize, 450}, 300, 600}],
 Row[{Spacer[12], Control[{{opacity, 0.5}, 0, 1}]}]
          }],
 ControlType -> {Slider, ColorSlider, VerticalSlider}, 
   ControlPlacement -> {Top, Left}, SaveDefinitions -> True];

The cursorcursors are visivlevisible as thin circles here, and the blue boundary is given in order to guide the eye, you may remove it and change parameters. Say, after you have successfully finished to built the polygon, change the color and the opacity to that you want the arrow to have.

Clear[strokeArea];
strokeArea[image_] :=
  Manipulate[
   DynamicModule[{pts = {}},
 
Column[{
  
   Dynamic@LocatorPane[Dynamic[pts],
    Dynamic@
     Show[{image, 
       Graphics[{color, EdgeForm[{color, Thickness[thickness]}], 
         Opacity[opacity], Polygon[pts]}]
                             }, ImageSize -> imageSize], 
    LocatorAutoCreate -> True, 
    Appearance -> 
     Graphics[{{color, Thickness[thickness], 
        Circle[{0, 0}, 0.5]}}, ImageSize -> 10]
                                          ],
  Button["Pick up the stroked Area",
   Clear[graphicsPolygon];
   graphicsPolygon = 
    Graphics[{color, EdgeForm[{color, Thickness[thickness]}], 
      Opacity[opacity], Thickness[thickness], Polygon[pts]}];
   ]
  }]
], Row[{Control[{{thickness, 0.005}, 0, 0.015}], Spacer[15], 
 Control[{color, Red}]}], Column[{
 Control[{{imageSize, 450}, 300, 600}],
 Row[{Spacer[12], Control[{{opacity, 0.5}, 0, 1}]}]
          }],
 ControlType -> {Slider, ColorSlider, VerticalSlider}, 
   ControlPlacement -> {Top, Left}, SaveDefinitions -> True];

The cursor are visivle as thin circles here, and the blue boundary is given in order to guide the eye, you may remove it.

Clear[strokeArea];

strokeArea[image_] := 

  Manipulate[
   DynamicModule[{pts = {}},
     Column[{
            Dynamic@LocatorPane[Dynamic[pts],
    Dynamic@
     Show[{image, 
       Graphics[{color, EdgeForm[{color, Thickness[thickness]}], 
         Opacity[opacity], Polygon[pts]}]
                             }, ImageSize -> imageSize], 
    LocatorAutoCreate -> True, 
    Appearance -> 
     Graphics[{{color, Thickness[thickness], 
        Circle[{0, 0}, 0.5]}}, ImageSize -> 10]
                                          ],
  Button["Pick up the stroked Area",
   Clear[graphicsPolygon];
   graphicsPolygon = 
    Graphics[{color, EdgeForm[{color, Thickness[thickness]}], 
      Opacity[opacity], Thickness[thickness], Polygon[pts]}];
   ]
  }]
], Row[{Control[{{thickness, 0.005}, 0, 0.015}], Spacer[15], 
 Control[{color, Red}]}], Column[{
 Control[{{imageSize, 450}, 300, 600}],
 Row[{Spacer[12], Control[{{opacity, 0.5}, 0, 1}]}]
          }],
 ControlType -> {Slider, ColorSlider, VerticalSlider}, 
   ControlPlacement -> {Top, Left}, SaveDefinitions -> True];

The cursors are visible as thin circles here, and the blue boundary is given in order to guide the eye, you may remove it and change parameters. Say, after you have successfully finished to built the polygon, change the color and the opacity to that you want the arrow to have.

Source Link
Alexei Boulbitch
  • 39.6k
  • 2
  • 47
  • 98
Loading