In its simplest form, and assuming linear change of torque with speed between the two lines & no outside influences:
t = b(p) + ((((r(p) - b(p)) / 50) * s);
t is result
b(p) is blue line value for the pedal position
r(p) is the red line value for the pedal position
s is speed.
The difference between the two lines at a given pedal position, divided by 50 to get 1km/h units, multiplied by the speed and added to the blue line value.
(Assuming I've not mistyped anything!).
Real-world applications typically use multi-dimensional lookup tables for this type of thing, with rather more inputs.