I didnt get good results with A GrabCut and just a Rectangle (i.e.: A method that can be fully automated). Whith some scribbles drawings the results improved a lot, but this cant be automated.
Generally its nearly impossible without AI to get a good segmentation or feature extraction when the background is in color and spatial distance partly very close to the color(s) of the object(s) of interest. If you want to fully automate the extraction of the bills, always use, if possible, the same background, probably a dark background would help, as long as the bills are of light colors.
With the ChainCode and some pre- and post- processing I get a result, that you may, or may not, think to be sufficient:
What I did was to:
1.) Resample down the image by a factor of 4 for better performance
2.) Blurred it with a large Kernel plus medium edge detection value (afaik named bilateral blurring)
3.) Used cardinal splines for ColorCurves, set lower colors lower, higher colors higher and the tension to 1.0f
4.) Applied the ChainCode in GrayscaleMode with a high threshold of 240
5.) Resampled the current result up again (factor 4)
6.) Used this result as AlphaMask for the original image.
Regards,
Thorsten