Use accumulated average for HSV value calculation
Fix array manipulation