In space, there is a lot of electromagnetic radiation from sun and other space objects.
No, there isn't. In classical physics, electromagnetic radiation is a wave phenomenon. Normally, waves of light pass through each other unperturbed. In quantum physics, there is such a thing as two-photon physics, but this takes very energetic photons. Neither the visible light from the Sun nor the radio waves from a spacecraft qualify as "very energetic". In short, there is no interference.
There is a problem if (for example) Mars is close to being directly behind the Sun as seen from the perspective of the Earth. In this case, an Earth-bound antenna pointing toward Mars will also be pointing toward the Sun. This would be a very bad day for that Earth-bound antenna. This means that communications with Earth are suspended for about a week or two every other year for vehicles on or near Mars. Communications with Mars is not a problem outside of these solar connections.
I see images of Mars by rovers, how is it noise-free and sharp?
By
- Designing communication protocols that are (to some extent) loss tolerant. This is, in part, the job of the Consultative Committee for Space Data Systems.
- Designing the communications capabilities of the spacecraft to be in line with the data to be gathered by the spacecraft. This is a collaborative effort between the designers of the spacecraft's science team, the designers of the spacecraft's communications system, the operators of the Deep Space Network.
- Making sure the spacecraft's antennae are properly aimed toward the Earth. This is one of the jobs of the spacecraft's guidance, navigation, and control system.
- Filtering downloaded data to remove effects such as salt and pepper noise. This is one of the jobs of the spacecraft data processing team.
- Plus doing a whole lot of other stuff that I didn't mention above.