I have bunch of EXIF files. I am looking for some heuristics to extract qualitative information such as if the picture is portrait or not, if the picture was taken in day or night, if the picture is scenary or something like that. Would you please help on how to get these kind of info from the EXIF files?
From the EXIF metadata you can calculate the “nominal” luminance of the scene, i.e. the luminance that the camera ought to render as midtones: use this exposure equation. This luminance should provide a good heuristic about whether it is a day or a night shot. But look also at the time the picture was taken: low luminance in day time probably means the picture was taken indoors.
You should have the information about the orientation of the camera, so you know whether the picture was taken in “portrait” or “landscape” mode, although this may not be well correlated with the actual contents of the picture... If it's recorded in the EXIF, a long focusing distance may be a better indicator that the picture is a landscape.
Look also at the focal length, chances are you don't take the same kind of pictures with a long or a short lens.
In any case, you will certainly have to find your own rules, since the possible correlations between EXIF data and picture contents will likely depend on your personal shooting style.