outputText = userCommand.getOutputTextInfo() port = IOutils.IOport(inputVideo, outputVideo, outputText) port.createFileInstancesUponRequirement() preprocessor = ImageProcessing.VideoPreprocessor(inputVideo) preprocessor.findSideToCrop() preprocessor.findCropPoints() scaleRatio = preprocessor.getDisplayTargetRatio() algo = ImageProcessing.Algorithm() arrowMaker = ImageProcessing.VideoArtist(scaleRatio) arrowMaker.findBestFrameMapping((8, 8)) monitor = IOutils.Display() frame = port.getInputVideoFrame() croppedFrame = preprocessor.cropFrameIntoSquare(frame) previousFrame = preprocessor.convertFrameIntoSpecifiedFormat(croppedFrame) while(port.inputVideoIsOpened()): try: frame = port.getInputVideoFrame() croppedFrame = preprocessor.cropFrameIntoSquare(frame) currentFrame = preprocessor.convertFrameIntoSpecifiedFormat(croppedFrame) OpticalFlow = algo.calculateOpticalFlow(previousFrame, currentFrame) displayFrame = preprocessor.convertFrameIntoOutputFormat(currentFrame) displayFrameMarkedWithFlow = arrowMaker.drawFlowArrows(displayFrame, OpticalFlow) port.logDataUponRequirement(displayFrameMarkedWithFlow, OpticalFlow) monitor.showFrame(displayFrameMarkedWithFlow)