Hi,
well, this kind of work should be done in editor and not at runtime.
but maybe you could make a scene that will process this image, save it into either xml or some scriptable object, or even in the scene itself that you then save as the scene for that level.
reading pixels will be fine, you don't need raycasting here.
you can also ksip nth pixels during your scan, that will speed up the process. or save to a lower resolution your image and scan that image for putting stuff in it.
Bye,
Jean