calculating the Cost-Volume with the given cost function to seperate fore- & background per frame (ad Task c)