c19000b012bba5fa7ae54fadc953f5b679dead4f,featurex/extractors/video.py,DenseOpticalFlowExtractor,_extract,#DenseOpticalFlowExtractor#Any#Any#,29

Before Change


            total_flow = flow.sum()

            value = Value(stim, self, {"total_flow": total_flow})
            event = Event(onset=f.onset, duration=f.duration, values=[value])
            events.append(event)

        return events

After Change


    def _extract(self, stim, show=False):

        flows = []
        onsets = []
        durations = []
        for i, f in enumerate(stim):

            img = f.data
            img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

            if i == 0:
                last_frame = img
                total_flow = 0

            flow = cv2.calcOpticalFlowFarneback(
                last_frame, img, 0.5, 3, 15, 3, 5, 1.2, 0)
            flow = np.sqrt((flow ** 2).sum(2))

            if show:
                cv2.imshow("frame", flow.astype("int8"))
                cv2.waitKey(1)

            last_frame = img
            flows.append(flow.sum())
            onsets.append(f.onset)
            durations.append(f.duration)

        return ExtractorResult(flows, stim, self, features=["total_flow"], 
                                onsets=onsets, durations=durations)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: tyarkoni/pliers
Commit Name: c19000b012bba5fa7ae54fadc953f5b679dead4f
Time: 2016-10-20
Author: quinten.mcnamara@gmail.com
File Name: featurex/extractors/video.py
Class Name: DenseOpticalFlowExtractor
Method Name: _extract


Project Name: tyarkoni/pliers
Commit Name: e98d99e745b61af768bd30fd9bad7c892eefbe17
Time: 2016-10-20
Author: quinten.mcnamara@gmail.com
File Name: featurex/extractors/api.py
Class Name: IndicoAPIExtractor
Method Name: _extract


Project Name: tyarkoni/pliers
Commit Name: 0a37dea8cd7bc8d533ee971cb6fc5ec59537f4b7
Time: 2017-10-22
Author: quinten.mcnamara@gmail.com
File Name: pliers/extractors/text.py
Class Name: PartOfSpeechExtractor
Method Name: _extract