What does Brightness/ intensity of spectral lines depend on?
The answer "The number of photons of same frequency or wavelength ABSORBED or EMITTED" from your book is a general way of saying when spectral lines are brighter (or darker). Your understanding of this general mechanism is (I think) mostly correct.

From what I understand, the differences in intensity of different spectral lines, however, is related to two (possibly more) things:

1) If a photon hits an atom (or molecule) and that photon has the exact energy needed to excite that atom does not necessarily means that the photon WILL be absorbed. There is an absorption probability associated with each energy transition. For example, one transition might have a 80% probability of absorption, while another has 0% (because the transition is forbidden).

2) Another factor that influences intensity is related to what state the system is in. For example, if two transitions, lets call them 0->2 and 1->2 both have a 100% probability of adsorption, but all the atoms/molecules are in state 0, then the 1->2 transition will not happen. That is, it will be dark/low intensity.

I hope this is helpful.