<h1>Mathematica, score: 10</h1> 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; k1 = Total[Flatten[ImageData@ DeleteSmallComponents[ FillingTransform[Dilation[EdgeDetect[#], 1], 10^6], 100], 1], 2] & /@ im; k2 = k1/3289 // Round k2 - k // Abs // Tr (* {3, 5, 12, 24, 50, 85, 119, 150, 156, 199}*) (* 10 *) Showing the process with the first sample: EdgeDetect[#] Detects edges :) ![Mathematica graphics](https://i.sstatic.net/2GnwN.png) Dilation[EdgeDetect[#], 1] dilates white regions by one pixel. It's needed to close the edge curves when the `EdgeDetect[]` function doesn't detect all the pixels laying on the edges to close the curves ![Mathematica graphics](https://i.sstatic.net/U6JPV.png) FillingTransform[Dilation[EdgeDetect[#], 1], 10^6] ![Mathematica graphics](https://i.sstatic.net/C3IPV.png) The following step, `DeleteSmallComponents[]` doesn't do anything with this image. It just delete small noise pixels when they exist `ImageData[...]` returns a binary array representing the image (1= white, 0= black) `k1 = Total[..]` just counts the white pixels on the image. Then I divide by 3289, an estimate of the rice grain surface. It's larger than what other answers use because I'm dilating the white areas.