I finished the refactor of FlatMask() with a proper ridge descriptor. I didn't follow the equations to the letter but got the grasp of it and it works.
I focused on the double line topic of the original post. To make the faint edge of the bus visible, in the edge mask you have to really pump up the values and hence will catch a lot of false positives because actually it isn't a line anymore but a slight shade.
The source is dirty (dot crawl, halos...) so I added some prefiltering before flatmask.
Code:
a=last
# Prefilter (Custom for this source)
ex_boxblur(0,1,mode="mean")
turnright()
ex_median("verticalS")
turnleft()
ex_median("IQM")
# Valley Mask
FlatMask(1)
# Add regular edge mask
a=a.ex_edge("qprewitt")
ex_lutxy(a,"x dup * 0.1 * y + 0.5 *")
# Clean up
ex_smooth(2,sharp=true)