Remus Hamza, 40, is alleged to have attacked the 20-year-old near Cardiff University as she walked home alone after a night out with friends on 20 September.
The prosecution at Newport Crown Court has alleged she was so drunk she could not have consented to sex.
The defendant, who is Romanian and lives in Cardiff, denies rape.
The court heard the woman lost her friends during her night out and started to walk home along Greyfriars Road, under an underpass by City Hall and then along Museum Avenue at about 02:00 GMT.
It was here she was approached by the defendant and the alleged rape happened behind a bush.
Claire Pickthall, prosecuting, told the jury the victim was "so drunk she can't remember the incident happening. She can't even remember him having sex with her".
It was this intoxication, she said, that meant she was not in any state to consent.
"The actions in these circumstances amount to rape," Ms Pickthall said.
"He was preying on single, drunk females."
The court heard Lee Neill, who saw Mr Hamza walking behind the National Museum of Wales with the victim, was so concerned he followed them.
Suspecting something "sinister", Mr Neill said he took a photograph "to use as evidence".
The flash frightened Mr Hamza, who ran off, the jury was told. After giving chase, Mr Neill lost Mr Hamza and returned to the alleged victim. He then called the police.
However, the court heard when officers spoke to the victim, she was so confused she thought Mr Neill was the man who raped her.
He was arrested and questioned but later released. DNA later led police to arrest Mr Hamza, the court was told.
The woman told jurors she had drunk wine, cider and cocktails during her night out.
She said she couldn't remember much of her journey home or the attack but insisted she would never have consented to having sex with a stranger.
"I have a moral compass'" she added.
A man accused of raping a student during fresher's week was preying on single, drunk women, a court has heard.