Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

interpolate 2 json files through timestamps

Files Description: The JSON files that we are dealing with describe videos data, meaning that we can produce the visuals of a video through it. The visuals are considered sequence of points drawn on a whiteboard screen with definite pen color and pen stroke width, each sequence of points creates an action (e.g., a line) and some number of actions are considered a period (e.g., paragraph). Simply, the video consists mainly of metadata and a sequence of periods that can contain sequence of actions, and actions can contain the points, each point is described using its coordinates and the time it was added to the screen.

Task Description: Now we have two JSON files (these will be the input files) that are recorded for the same video but with different developers, these two files are of only one period and each one contains one action and they have different number of points in their actions. Suppose that "file1.json" descripes the main video with correct video duration and action starting and ending, durations and period (starting and ending) durations (that is compatible with a definite audio file) and we need to edit the timestamps in the "file2.json" to match that for the "file1.json" so we will able to add the main audio file to the resulted video that have the points (x and y coordinates) of "file2.json", we need therefore to change the start and the end of each period timestamp and to be like those in "file1.json" with the same order and to interpolate the timestamps of the points in between in the new JSON file.

Output: 1- We need the output "file3.json" having the points coordinates of "file2.json" but matches the timestamps of "file1.json" but after interpolation. Please notice that the number of points in the two actions are not equal.

2- We need a CSV file that should be created from the Python script using “pandas DataFrame” that includes, two columns, the first column is the timestamps of in "file2.json" and the second is the new timestamps that are mapped and replaced in the "file3.json".

files example and other files in links : https://drive.google.com/open?id=143VOctHopkZtDrLdzrWe7kndky6Shrnz

{
  "height": 756,
  "platform": "iOS",
  "periods": [
{    
      "id": 2,
      "type": "recording",
      "startTime": 0,
      "endTime": 4962,
      "actions": [
        {
          "startTime": 3944,
          "actionID": 111,
          "endTime": 4962,
          "action": "createShape",
          "points": [
            {
              "t": 3944,
              "x": 316.5,
              "y": 330.5
            },
            {
              "t": 3950,
              "x": 316.5,
              "y": 331
            },
            {
              "t": 4385,
              "x": 429,
              "y": 331.5
            },
            {
              "t": 4401,
              "x": 434,
              "y": 331.5
            },
            {
              "t": 4417,
              "x": 440.5,
              "y": 331
            },
            {
              "t": 4434,
              "x": 447.5,
              "y": 330
            },
            {
              "t": 4452,
              "x": 455.5,
              "y": 329
            },
            {
              "t": 4471,
              "x": 461,
              "y": 328.5
            },
            {
              "t": 4484,
              "x": 467,
              "y": 328.5
            },
            {
              "t": 4501,
              "x": 471.5,
              "y": 328.5
            },
            {
              "t": 4522,
              "x": 473,
              "y": 328.5
            },
            {
              "t": 4522,
              "x": 479.5,
              "y": 328.5
            },
            {
              "t": 4533,
              "x": 484,
              "y": 328
            },
            {
              "t": 4550,
              "x": 490,
              "y": 327
            },

            {
              "t": 4962,
              "x": 553,
              "y": 321.5
            }
          ],
          "strokeWidth": 5,
          "strokeColor": "#F8A602",
          "type": "pen"
        }
      ]
    }
  ],
  "width": 1344,
  "duration": 4962
}

This is the problem itself , but I can’t understand what interpolation and relationship between time stamp and x , y axis ?

Comments