Let $G$ be a compact simple Lie group, and let $\rho$ be a (faithful, unitary) irreducible representation thereof of $\mathbb K$-dimension $n$, where $\mathbb K=\mathbb C/\mathbb R/\mathbb H$ if $R$ is real/complex/pseudo-real, respectively. It then follows that there is a subgroup of $SU(n)/SO(n)/Sp(n)$, respectively, isomorphic to $G$. One can think of $\rho$ as a map from $G$ to this subgroup.
How can I check whether a given matrix $M\in SU(n)/SO(n)/Sp(n)$ is in the image of $\rho$? In other words, given one such matrix $M$, how can I decide whether there exists some $g\in G$ such that $\rho(g)=M$?
For the sake of concreteness, say $G=G_2$ is the first exceptional simple group, and let $\rho$ be the representation with highest weight $2\omega_2$ (which is real and $27$-dimensional). This means that for any $g\in G_2$, $\rho(g)$ is a $27$-dimensional orthogonal matrix. If I take some arbitrary $27$-dimensional orthogonal matrix $M$, how can I check whether it can be written as $M=\rho(g)$ for some $g\in G_2$?
Note: I am particularly interested in the case where $M$ is diagonal, but I'd be interested in hearing about the general case as well. In the diagonal case, where everything is abelian, and one can essentially focus on a Cartan subalgebra, I assume one can be quite explicit about the image of $\rho$. In the general case, I wouldn't be surprised if one has to work harder.