# Trouble aligning Graphics with Image

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}
} )]
},
];


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?

Show[img, Graphics@{Red, Point@GetCorners[img]}]


• Wow, that's much more terse than mine. Upvote for that. Mar 11, 2016 at 2:10
• @Skurmedel Mixing images and graphics need some practice. Usually the most obvious thing works. But when it doesn't you're in a dangerous terrain. Mar 11, 2016 at 3:08
• That terrain does look dangerous, with the tank and all :-p Mar 11, 2016 at 15:05

Well I solved my own problem :), I used Show[img, g], which did the business.