I import the test image eloquently named "Tank2":
img = ExampleData[{"TestImage", "Tank2"}]
And do an extremly poor corner detection:
GetCorners[img_] :=
Module[{
filtered = ImageConvolve[GaussianFilter[img, 1.1], ( {
{0, -1, 0},
{-1, 4, -1},
{0, -1, 0}
} )]
},
ImageValuePositions[filtered // ImageAdjust, White, 0.5]
];
Now I want to overlay the "corners" as small circles, and do this:
g = Graphics[{{Red, Circle[#1, 1]} & /@ GetCorners[img]},
ImageSize -> ImageDimensions[img], PlotRangeClipping -> True,
AspectRatio -> ImageAspectRatio[img]]
ImageCompose[img, g]
Alas, the result is not aligned, as you can see below, what to do? Is there a better way to draw "on top" of an image? I guess the Graphics function pads the image in some way, then crops it with the wrong midpoint?