ImageValuePositions
, new in 9, can return a list of white pixel positions.
i = Import@"https://i.stack.imgur.com/opzqB.png";
p = ImageValuePositions[i, White] // Mean
(* {298.896, 21.3231} *)
HighlightImage[i, {p},
Method -> {"CrossMarkers", 5}]
Update: Surrounding rectangle
Get the min/max of white pixel coordinates.
whites = ImageValuePositions[i, White];
corners = Transpose[{
Through[{Min, Max}[First /@ whites]],
Through[{Min, Max}[Last /@ whites]]}]
(* {{218.5, 0.5}, {373.5, 50.5}} *)
Make a rectangle boundary and highlight that region on the image.
rect = corners /. {{x1_, y1_}, {x2_, y2_}} :>
With[{dx = 2}, Join[
Table[{x1, y1} + {0, y}, {y, 0, y2 - y1, dx}],
Table[{x1, y2} + {x, 0}, {x, 0, x2 - x1, dx}],
Table[{x2, y2} - {0, y}, {y, 0, y2 - y1, dx}],
Table[{x2, y1} - {x, 0}, {x, 0, x2 - x1, dx}]]];
HighlightImage[i, rect,
Method -> {"DiskMarkers", 1}]