You can modify the command from your link
How to find all images with a certain pixel size using command line?
This will print filenames with pictures approximatly landscape 16/9:
find . -iname "*.jpg" -type f -exec identify -format '%w %h %i\n' '{}' \; | awk '$1/$2>1.7 && $1/$2<1.8 {print $3}'
This will do the same with approximatly portrait 9/16:
find . -iname "*.jpg" -type f -exec identify -format '%w %h %i\n' '{}' \; | awk '$1/$2>0.5 && $1/$2<0.6 {print $3}'
Of course you can use the math in awk in more sophisticated way (for better reading only the awk part):
awk 'sqrt((($1/$2)-(16/9))^2)<sqrt(0.5^2) {print $3}'
As awk has no "abs" function, I just use created it using "^2" and "sqrt" to check if the ratio is inside a "delta" (in this example 0.5).