Skip to main content
Typo fix
Source Link
Toby Speight
  • 6.5k
  • 1
  • 24
  • 41

Mathematica, score: 7

i = {"https://i.sstatic.net/8T6W2.jpg",  "https://i.sstatic.net/pgWt1.jpg", 
     "https://i.sstatic.net/M0K5w.jpg",  "https://i.sstatic.net/eUFNo.jpg", 
     "https://i.sstatic.net/2TFdi.jpg",  "https://i.sstatic.net/wX48v.jpg", 
     "https://i.sstatic.net/eXCGt.jpg",  "https://i.sstatic.net/9na4J.jpg",
     "https://i.sstatic.net/UMP9V.jpg",  "https://i.sstatic.net/nP3Hr.jpg"};

im = Import /@ i;

I think the function'sfunctions' names are descriptive enough:

getSatHSVChannelAndBinarize[i_Image]             := Binarize@ColorSeparate[i, "HSB"][[2]]
removeSmallNoise[i_Image]                        := DeleteSmallComponents[i, 100]
fillSmallHoles[i_Image]                          := Closing[i, 1]
getMorphologicalComponentsAreas[i_Image]         := ComponentMeasurements[i, "Area"][[All, 2]]
roundAreaSizeToGrainCount[areaSize_, grainSize_] := Round[areaSize/grainSize]

Processing all the pictures at once:

counts = Plus @@@
  (roundAreaSizeToGrainCount[#, 2900] & /@
      (getMorphologicalComponentsAreas@
        fillSmallHoles@
         removeSmallNoise@
          getSatHSVChannelAndBinarize@#) & /@ im)

(* Output {3, 5, 12, 25, 49, 83, 118, 149, 152, 202} *)

The score is:

counts - {3, 5, 12, 25, 50, 83, 120, 150, 151, 200} // Abs // Total
(* 7 *)

Here you can see the score sensitivity wrt the grain size used:

Mathematica graphics

Mathematica, score: 7

i = {"https://i.sstatic.net/8T6W2.jpg",  "https://i.sstatic.net/pgWt1.jpg", 
     "https://i.sstatic.net/M0K5w.jpg",  "https://i.sstatic.net/eUFNo.jpg", 
     "https://i.sstatic.net/2TFdi.jpg",  "https://i.sstatic.net/wX48v.jpg", 
     "https://i.sstatic.net/eXCGt.jpg",  "https://i.sstatic.net/9na4J.jpg",
     "https://i.sstatic.net/UMP9V.jpg",  "https://i.sstatic.net/nP3Hr.jpg"};

im = Import /@ i;

I think the function's names are descriptive enough:

getSatHSVChannelAndBinarize[i_Image]             := Binarize@ColorSeparate[i, "HSB"][[2]]
removeSmallNoise[i_Image]                        := DeleteSmallComponents[i, 100]
fillSmallHoles[i_Image]                          := Closing[i, 1]
getMorphologicalComponentsAreas[i_Image]         := ComponentMeasurements[i, "Area"][[All, 2]]
roundAreaSizeToGrainCount[areaSize_, grainSize_] := Round[areaSize/grainSize]

Processing all the pictures at once:

counts = Plus @@@
  (roundAreaSizeToGrainCount[#, 2900] & /@
      (getMorphologicalComponentsAreas@
        fillSmallHoles@
         removeSmallNoise@
          getSatHSVChannelAndBinarize@#) & /@ im)

(* Output {3, 5, 12, 25, 49, 83, 118, 149, 152, 202} *)

The score is:

counts - {3, 5, 12, 25, 50, 83, 120, 150, 151, 200} // Abs // Total
(* 7 *)

Here you can see the score sensitivity wrt the grain size used:

Mathematica graphics

Mathematica, score: 7

i = {"https://i.sstatic.net/8T6W2.jpg",  "https://i.sstatic.net/pgWt1.jpg", 
     "https://i.sstatic.net/M0K5w.jpg",  "https://i.sstatic.net/eUFNo.jpg", 
     "https://i.sstatic.net/2TFdi.jpg",  "https://i.sstatic.net/wX48v.jpg", 
     "https://i.sstatic.net/eXCGt.jpg",  "https://i.sstatic.net/9na4J.jpg",
     "https://i.sstatic.net/UMP9V.jpg",  "https://i.sstatic.net/nP3Hr.jpg"};

im = Import /@ i;

I think the functions' names are descriptive enough:

getSatHSVChannelAndBinarize[i_Image]             := Binarize@ColorSeparate[i, "HSB"][[2]]
removeSmallNoise[i_Image]                        := DeleteSmallComponents[i, 100]
fillSmallHoles[i_Image]                          := Closing[i, 1]
getMorphologicalComponentsAreas[i_Image]         := ComponentMeasurements[i, "Area"][[All, 2]]
roundAreaSizeToGrainCount[areaSize_, grainSize_] := Round[areaSize/grainSize]

Processing all the pictures at once:

counts = Plus @@@
  (roundAreaSizeToGrainCount[#, 2900] & /@
      (getMorphologicalComponentsAreas@
        fillSmallHoles@
         removeSmallNoise@
          getSatHSVChannelAndBinarize@#) & /@ im)

(* Output {3, 5, 12, 25, 49, 83, 118, 149, 152, 202} *)

The score is:

counts - {3, 5, 12, 25, 50, 83, 120, 150, 151, 200} // Abs // Total
(* 7 *)

Here you can see the score sensitivity wrt the grain size used:

Mathematica graphics

deleted 28 characters in body
Source Link
Dr. belisarius
  • 5.5k
  • 1
  • 19
  • 36

Mathematica, score: 7

k = {3, 5, 12, 25, 50, 83, 120, 150, 151, 200};
i = {"https://i.sstatic.net/8T6W2.jpg",  "https://i.sstatic.net/pgWt1.jpg", 
     "https://i.sstatic.net/M0K5w.jpg",    "https://i.sstatic.net/eUFNo.jpg", 
     "https://i.sstatic.net/2TFdi.jpg",    "https://i.sstatic.net/wX48v.jpg", 
     "https://i.sstatic.net/eXCGt.jpg",    "https://i.sstatic.net/9na4J.jpg",
     "https://i.sstatic.net/UMP9V.jpg",    "https://i.sstatic.net/nP3Hr.jpg"};

im = Import /@ i;

I think the function's names are descriptive enough:

getSatHSVChannelAndBinarize[i_Image]             := Binarize@ColorSeparate[i, "HSB"][[2]]
removeSmallNoise[i_Image]                        := DeleteSmallComponents[i, 100]
fillSmallHoles[i_Image]                          := Closing[i, 1]
getMorphologicalComponentsAreas[i_Image]         := ComponentMeasurements[i, "Area"][[All, 2]]
roundAreaSizeToGrainCount[areaSize_, grainSize_] := Round[areaSize/grainSize]

Processing all the pictures at once:

counts = Plus @@@
  (roundAreaSizeToGrainCount[#, 2900] & /@
      (getMorphologicalComponentsAreas@
        fillSmallHoles@
         removeSmallNoise@
          getSatHSVChannelAndBinarize@#) & /@ im)

(* Output {3, 5, 12, 25, 49, 83, 118, 149, 152, 202} *)

The score is:

counts - {3, 5, 12, 25, 50, 83, 120, 150, 151, 200} // Abs // Total
(* 7 *)

Here you can see the score sensitivity wrt the grain size used:

Mathematica graphics

Mathematica, score: 7

k = {3, 5, 12, 25, 50, 83, 120, 150, 151, 200};
i = {"https://i.sstatic.net/8T6W2.jpg",  "https://i.sstatic.net/pgWt1.jpg", 
   "https://i.sstatic.net/M0K5w.jpg",    "https://i.sstatic.net/eUFNo.jpg", 
   "https://i.sstatic.net/2TFdi.jpg",    "https://i.sstatic.net/wX48v.jpg", 
   "https://i.sstatic.net/eXCGt.jpg",    "https://i.sstatic.net/9na4J.jpg",
   "https://i.sstatic.net/UMP9V.jpg",    "https://i.sstatic.net/nP3Hr.jpg"};

I think the function's names are descriptive enough:

getSatHSVChannelAndBinarize[i_Image]             := Binarize@ColorSeparate[i, "HSB"][[2]]
removeSmallNoise[i_Image]                        := DeleteSmallComponents[i, 100]
fillSmallHoles[i_Image]                          := Closing[i, 1]
getMorphologicalComponentsAreas[i_Image]         := ComponentMeasurements[i, "Area"][[All, 2]]
roundAreaSizeToGrainCount[areaSize_, grainSize_] := Round[areaSize/grainSize]

Processing all the pictures at once:

counts = Plus @@@
  (roundAreaSizeToGrainCount[#, 2900] & /@
      (getMorphologicalComponentsAreas@
        fillSmallHoles@
         removeSmallNoise@
          getSatHSVChannelAndBinarize@#) & /@ im)

(* Output {3, 5, 12, 25, 49, 83, 118, 149, 152, 202} *)

The score is:

counts - {3, 5, 12, 25, 50, 83, 120, 150, 151, 200} // Abs // Total
(* 7 *)

Here you can see the score sensitivity wrt the grain size used:

Mathematica graphics

Mathematica, score: 7

i = {"https://i.sstatic.net/8T6W2.jpg",  "https://i.sstatic.net/pgWt1.jpg", 
     "https://i.sstatic.net/M0K5w.jpg",  "https://i.sstatic.net/eUFNo.jpg", 
     "https://i.sstatic.net/2TFdi.jpg",  "https://i.sstatic.net/wX48v.jpg", 
     "https://i.sstatic.net/eXCGt.jpg",  "https://i.sstatic.net/9na4J.jpg",
     "https://i.sstatic.net/UMP9V.jpg",  "https://i.sstatic.net/nP3Hr.jpg"};

im = Import /@ i;

I think the function's names are descriptive enough:

getSatHSVChannelAndBinarize[i_Image]             := Binarize@ColorSeparate[i, "HSB"][[2]]
removeSmallNoise[i_Image]                        := DeleteSmallComponents[i, 100]
fillSmallHoles[i_Image]                          := Closing[i, 1]
getMorphologicalComponentsAreas[i_Image]         := ComponentMeasurements[i, "Area"][[All, 2]]
roundAreaSizeToGrainCount[areaSize_, grainSize_] := Round[areaSize/grainSize]

Processing all the pictures at once:

counts = Plus @@@
  (roundAreaSizeToGrainCount[#, 2900] & /@
      (getMorphologicalComponentsAreas@
        fillSmallHoles@
         removeSmallNoise@
          getSatHSVChannelAndBinarize@#) & /@ im)

(* Output {3, 5, 12, 25, 49, 83, 118, 149, 152, 202} *)

The score is:

counts - {3, 5, 12, 25, 50, 83, 120, 150, 151, 200} // Abs // Total
(* 7 *)

Here you can see the score sensitivity wrt the grain size used:

Mathematica graphics

deleted 6 characters in body
Source Link
Dr. belisarius
  • 5.5k
  • 1
  • 19
  • 36

Mathematica, score: 7

k = {3, 5, 12, 25, 50, 83, 120, 150, 151, 200};
i = {"https://i.sstatic.net/8T6W2.jpg",  "https://i.sstatic.net/pgWt1.jpg", 
   "https://i.sstatic.net/M0K5w.jpg",    "https://i.sstatic.net/eUFNo.jpg", 
   "https://i.sstatic.net/2TFdi.jpg",    "https://i.sstatic.net/wX48v.jpg", 
   "https://i.sstatic.net/eXCGt.jpg",    "https://i.sstatic.net/9na4J.jpg",
   "https://i.sstatic.net/UMP9V.jpg",    "https://i.sstatic.net/nP3Hr.jpg"};

I think the function's names are descriptive enough:

getSatHSVChannelAndBinarize[i_Image]             := Binarize@ColorSeparate[i, "HSB"][[2]]
removeSmallNoise[i_Image]                        := DeleteSmallComponents[i, 100]
fillSmallHoles[i_Image]                          := Closing[i, 1]
getMorphologicalComponentsAreas[i_Image]         := ComponentMeasurements[i, "Area"][[All, 2]]
roundAreaSizeToGrainCount[areaSize_, grainSize_] := Round[areaSize/grainSize]

Processing all the pictures at once:

counts = Plus @@@
  (roundAreaSizeToGrainCount[#, 2900] & /@
      (getMorphologicalComponentsAreas@
        fillSmallHoles@
         removeSmallNoise@
          getSatHSVChannelAndBinarize@#) & /@ im)

(* Output {3, 5, 12, 25, 49, 83, 118, 149, 152, 202} *)

The score is:

counts - {3, 5, 12, 25, 50, 83, 120, 150, 151, 200} // Abs // Total
(* 7 *)

Here you can see the sensitivity of the score tosensitivity wrt the grain size used:

Mathematica graphics

Mathematica, score: 7

k = {3, 5, 12, 25, 50, 83, 120, 150, 151, 200};
i = {"https://i.sstatic.net/8T6W2.jpg",  "https://i.sstatic.net/pgWt1.jpg", 
   "https://i.sstatic.net/M0K5w.jpg",    "https://i.sstatic.net/eUFNo.jpg", 
   "https://i.sstatic.net/2TFdi.jpg",    "https://i.sstatic.net/wX48v.jpg", 
   "https://i.sstatic.net/eXCGt.jpg",    "https://i.sstatic.net/9na4J.jpg",
   "https://i.sstatic.net/UMP9V.jpg",    "https://i.sstatic.net/nP3Hr.jpg"};

I think the function's names are descriptive enough:

getSatHSVChannelAndBinarize[i_Image]             := Binarize@ColorSeparate[i, "HSB"][[2]]
removeSmallNoise[i_Image]                        := DeleteSmallComponents[i, 100]
fillSmallHoles[i_Image]                          := Closing[i, 1]
getMorphologicalComponentsAreas[i_Image]         := ComponentMeasurements[i, "Area"][[All, 2]]
roundAreaSizeToGrainCount[areaSize_, grainSize_] := Round[areaSize/grainSize]

Processing all the pictures at once:

counts = Plus @@@
  (roundAreaSizeToGrainCount[#, 2900] & /@
      (getMorphologicalComponentsAreas@
        fillSmallHoles@
         removeSmallNoise@
          getSatHSVChannelAndBinarize@#) & /@ im)

(* Output {3, 5, 12, 25, 49, 83, 118, 149, 152, 202} *)

The score is:

counts - {3, 5, 12, 25, 50, 83, 120, 150, 151, 200} // Abs // Total
(* 7 *)

Here you can see the sensitivity of the score to the grain size used:

Mathematica graphics

Mathematica, score: 7

k = {3, 5, 12, 25, 50, 83, 120, 150, 151, 200};
i = {"https://i.sstatic.net/8T6W2.jpg",  "https://i.sstatic.net/pgWt1.jpg", 
   "https://i.sstatic.net/M0K5w.jpg",    "https://i.sstatic.net/eUFNo.jpg", 
   "https://i.sstatic.net/2TFdi.jpg",    "https://i.sstatic.net/wX48v.jpg", 
   "https://i.sstatic.net/eXCGt.jpg",    "https://i.sstatic.net/9na4J.jpg",
   "https://i.sstatic.net/UMP9V.jpg",    "https://i.sstatic.net/nP3Hr.jpg"};

I think the function's names are descriptive enough:

getSatHSVChannelAndBinarize[i_Image]             := Binarize@ColorSeparate[i, "HSB"][[2]]
removeSmallNoise[i_Image]                        := DeleteSmallComponents[i, 100]
fillSmallHoles[i_Image]                          := Closing[i, 1]
getMorphologicalComponentsAreas[i_Image]         := ComponentMeasurements[i, "Area"][[All, 2]]
roundAreaSizeToGrainCount[areaSize_, grainSize_] := Round[areaSize/grainSize]

Processing all the pictures at once:

counts = Plus @@@
  (roundAreaSizeToGrainCount[#, 2900] & /@
      (getMorphologicalComponentsAreas@
        fillSmallHoles@
         removeSmallNoise@
          getSatHSVChannelAndBinarize@#) & /@ im)

(* Output {3, 5, 12, 25, 49, 83, 118, 149, 152, 202} *)

The score is:

counts - {3, 5, 12, 25, 50, 83, 120, 150, 151, 200} // Abs // Total
(* 7 *)

Here you can see the score sensitivity wrt the grain size used:

Mathematica graphics

deleted 253 characters in body
Source Link
Dr. belisarius
  • 5.5k
  • 1
  • 19
  • 36
Loading
added 43 characters in body
Source Link
Dr. belisarius
  • 5.5k
  • 1
  • 19
  • 36
Loading
added 980 characters in body
Source Link
Dr. belisarius
  • 5.5k
  • 1
  • 19
  • 36
Loading
deleted 29 characters in body
Source Link
Dr. belisarius
  • 5.5k
  • 1
  • 19
  • 36
Loading
deleted 3 characters in body
Source Link
Dr. belisarius
  • 5.5k
  • 1
  • 19
  • 36
Loading
deleted 3 characters in body
Source Link
Dr. belisarius
  • 5.5k
  • 1
  • 19
  • 36
Loading
Source Link
Dr. belisarius
  • 5.5k
  • 1
  • 19
  • 36
Loading