not knowing what brand and or quality of carpet you have,mix a weak solution of iron out and water,try in an area that is out of site in case of even a weak solution taking the color out,if it doesnt discolor the carpet,scrub the affected area with a stiff nylon brush and solution,and rinse liberally with straight water.