| | |
| | | { |
| | | "cell_type": "code", |
| | | "execution_count": 1, |
| | | "metadata": { |
| | | "collapsed": false |
| | | }, |
| | | "metadata": {}, |
| | | "outputs": [], |
| | | "source": [ |
| | | "import numpy as np\n", |
| | |
| | | }, |
| | | { |
| | | "cell_type": "code", |
| | | "execution_count": 2, |
| | | "metadata": { |
| | | "collapsed": false |
| | | }, |
| | | "execution_count": 3, |
| | | "metadata": {}, |
| | | "outputs": [], |
| | | "source": [ |
| | | "video_path = '../data/video/SWC016_2016_04_08_pivothead_AVI.avi'\n", |
| | | "bbox_path = '../data/video/annotations/SWC016_childface.txt'\n", |
| | | "video_path = '../data/video/SGT036_2016_07_25_pivothead_AVI.avi'\n", |
| | | "bbox_path = '../data/video/annotations/SGT036_childface.txt'\n", |
| | | "\n", |
| | | "annot_path = '../output/video/output-SWC016_normal_1e-5_epoch_20.txt'\n", |
| | | "output_string = 'SWC016_normal_1e-5_epoch_20_smooth'" |
| | | "annot_path = '../output/video/output-SGT036_set4_normal_a1_epoch_25.txt'\n", |
| | | "output_string = 'SGT036_set4_normal_a1_epoch_25_smooth'" |
| | | ] |
| | | }, |
| | | { |
| | | "cell_type": "code", |
| | | "execution_count": 3, |
| | | "metadata": { |
| | | "collapsed": false |
| | | }, |
| | | "execution_count": 4, |
| | | "metadata": {}, |
| | | "outputs": [ |
| | | { |
| | | "name": "stdout", |
| | | "output_type": "stream", |
| | | "text": [ |
| | | "[ -1.15884 -14.885593 -16.727406 ..., -57.590378 -56.963156 -58.641377]\n", |
| | | "(9322,)\n", |
| | | "(63691,)\n" |
| | | "[ 2.843239 6.065323 6.614468 ..., -0.936905 -1.396786 -3.20248 ]\n", |
| | | "(8508,)\n", |
| | | "(53464,)\n" |
| | | ] |
| | | } |
| | | ], |
| | |
| | | }, |
| | | { |
| | | "cell_type": "code", |
| | | "execution_count": 4, |
| | | "metadata": { |
| | | "collapsed": false |
| | | }, |
| | | "execution_count": 5, |
| | | "metadata": {}, |
| | | "outputs": [ |
| | | { |
| | | "name": "stdout", |
| | |
| | | } |
| | | ], |
| | | "source": [ |
| | | "window_len = 7\n", |
| | | "window_len = 3\n", |
| | | "pad = window_len / 2\n", |
| | | "window = 'flat'\n", |
| | | "window_2 = 'flat'\n", |
| | |
| | | { |
| | | "cell_type": "code", |
| | | "execution_count": 7, |
| | | "metadata": { |
| | | "collapsed": false |
| | | }, |
| | | "metadata": {}, |
| | | "outputs": [ |
| | | { |
| | | "name": "stdout", |
| | |
| | | ], |
| | | "source": [ |
| | | "video = cv2.VideoCapture(video_path)\n", |
| | | "width = int(video.get(cv2.CAP_PROP_FRAME_WIDTH)) # float\n", |
| | | "height = int(video.get(cv2.CAP_PROP_FRAME_HEIGHT)) # float\n", |
| | | "# New cv2\n", |
| | | "# width = int(video.get(cv2.CAP_PROP_FRAME_WIDTH)) # float\n", |
| | | "# height = int(video.get(cv2.CAP_PROP_FRAME_HEIGHT)) # float\n", |
| | | "#\n", |
| | | "# # Define the codec and create VideoWriter object\n", |
| | | "# fourcc = cv2.VideoWriter_fourcc(*'MJPG')\n", |
| | | "# out = cv2.VideoWriter('output/video/output-%s.avi' % args.output_string, fourcc, 30.0, (width, height))\n", |
| | | "\n", |
| | | "# Old cv2\n", |
| | | "width = int(video.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)) # float\n", |
| | | "height = int(video.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)) # float\n", |
| | | "\n", |
| | | "# Define the codec and create VideoWriter object\n", |
| | | "fourcc = cv2.VideoWriter_fourcc(*'MJPG')\n", |
| | | "fourcc = cv2.cv.CV_FOURCC(*'MJPG')\n", |
| | | "out = cv2.VideoWriter('../output/video/output-%s.avi' % output_string, fourcc, 30.0, (width, height))\n", |
| | | "\n", |
| | | "txt_out = open('../output/video/output-%s.txt' % output_string, 'w')\n", |
| | |
| | | "metadata": { |
| | | "anaconda-cloud": {}, |
| | | "kernelspec": { |
| | | "display_name": "Python [conda root]", |
| | | "display_name": "Python 2", |
| | | "language": "python", |
| | | "name": "conda-root-py" |
| | | "name": "python2" |
| | | }, |
| | | "language_info": { |
| | | "codemirror_mode": { |
| | |
| | | "name": "python", |
| | | "nbconvert_exporter": "python", |
| | | "pygments_lexer": "ipython2", |
| | | "version": "2.7.12" |
| | | "version": "2.7.13" |
| | | } |
| | | }, |
| | | "nbformat": 4, |