Which STM32 device are you talking about? They vary greatly in their memory size, speed, and other characteristics.
How fast do you need to make the determination?
Also what other activities is the MCU undertaking at the same time (such as running the satellite)?
Is the determination just (say) 'super bright = Sun; super dark = space; anything in between is earth' or is there some other characteristic(s) that you need to use (colour, density of light areas to tell the night-side from 'space'....)
Susan