code: def rgb2cmy(self, img, whitebg=False):
          
          tmp = img*1.0
          if whitebg:
              tmp = (1.0 - (img - img.min())/(img.max() - img.min()))
          out = tmp*0.0
          out[:,:,0] = (tmp[:,:,1] + tmp[:,:,2])/2.0
          out[:,:,1] = (tmp[:,:,0] + tmp[:,:,2])/2.0
          out[:,:,2] = (tmp[:,:,0] + tmp[:,:,1])/2.0
          return out
docs: transforms image from RGB to CMY