Im trying to automate the processing of my shooting targets to measure my performance in the range.
I was able to process the shots, but I still have to select the center of the target by the use of locator function.
Tried using the following questions as a base Detecting Grid Lines
src = ColorSeparate[Import["http://i.imgur.com/BW61u.jpg"], "RGB"][[1]];
p = ImageDimensions[src]/2;
shots = DeleteCases[DeleteCases[Last /@ ComponentMeasurements[MaxDetect@DistanceTransform
@ColorNegate@DeleteSmallComponents@
Binarize[
Closing[ImageAdjust[Blur@Blur@Blur@src, {1, 1}], 2]],
"Centroid"], {0.5, ___}], {___, 0.5}];
pts = Graphics[{Red, PointSize[Large], Point[#]}] & /@ shots;
Show[src, pts, Graphics[Locator[Dynamic[p]]]]
With the locator in place I can now extract the actual shots with respect to the center of the target.
values = (# - p)/100 & /@ shots;
sigImage =
DensityHistogram[values, {0.2}, ColorFunction -> "DarkRainbow",
Method -> {"DistributionAxes" -> True},
ChartBaseStyle -> EdgeForm[Thin],
GridLines -> {{{0, {Red, Dashed, Thick}}}, {{0, {Red, Thick,
Dashed}}}}, PlotRange -> {{-2, 2}, {-2, 2}}]
I would like for Mathematica to be able to find the center of the target automatically, so then I can create a program to process several targets which I can extract the shots automatically and save in a database, which I can then use to review the Density Histograms of different dates, weapons, distances, stances, etc.