The algorithm as posted only counts pixels that are green and only green. There is no provision for counting something that is 'almost' green.
The (0,255,0) represents the color...that's 0 parts red, 255 parts green, 0 parts blue.
The color (0,255,1) while visually VERY close, is not the 'pure' green and would not be counted.
Could this be your problem?