# HG changeset patch # User Nicolas Saunier # Date 1498189216 14400 # Node ID 0e017178f7abf1dc10dfdf3c795eb1313a222501 # Parent 8f60ecfc2f06632a7bf17b9dc312fc7f6f5ed665 correct bug in classify-objects script when correcting for distrotion diff -r 8f60ecfc2f06 -r 0e017178f7ab scripts/classify-objects.py --- a/scripts/classify-objects.py Thu Jun 22 18:08:46 2017 -0400 +++ b/scripts/classify-objects.py Thu Jun 22 23:40:16 2017 -0400 @@ -73,6 +73,7 @@ if undistort: # setup undistortion [map1, map2] = cvutils.computeUndistortMaps(width, height, undistortedImageMultiplication, intrinsicCameraMatrix, distortionCoefficients) + height, width = map1.shape pastObjects = [] currentObjects = [] diff -r 8f60ecfc2f06 -r 0e017178f7ab scripts/extract-appearance-images.py --- a/scripts/extract-appearance-images.py Thu Jun 22 18:08:46 2017 -0400 +++ b/scripts/extract-appearance-images.py Thu Jun 22 23:40:16 2017 -0400 @@ -3,7 +3,7 @@ import numpy as np, cv2 import argparse, os from pandas import read_csv -from matplotlib.pyplot import imsave +from matplotlib.pyplot import imsave, imshow, figure import cvutils, moving, ml, storage @@ -53,6 +53,7 @@ if undistort: # setup undistortion [map1, map2] = cvutils.computeUndistortMaps(width, height, undistortedImageMultiplication, intrinsicCameraMatrix, distortionCoefficients) + height, width = map1.shape print(timeInterval) if capture.isOpened(): @@ -69,10 +70,10 @@ img = cv2.remap(img, map1, map2, interpolation=cv2.INTER_LINEAR) for obj in objects: if obj.existsAtInstant(frameNum): - if (obj.getFirstInstant()-frameNum)%args.nFramesStep == 0: # todo find next non zero image if none + if (10+frameNum-obj.getFirstInstant())%args.nFramesStep == 0: # todo find next non zero image if none croppedImg = cvutils.imageBox(img, obj, frameNum, invHomography, width, height, classifierParams.percentIncreaseCrop, classifierParams.percentIncreaseCrop, classifierParams.minNPixels) if croppedImg is not None: - imsave(args.directoryName+os.sep+moving.userTypeNames[obj.getUserType()]+args.imagePrefix+'-{}-{}.png'.format(obj.getNum(), frameNum), croppedImg) + imsave(args.directoryName+os.sep+moving.userTypeNames[obj.getUserType()]+os.sep+args.imagePrefix+'-{}-{}.png'.format(obj.getNum(), frameNum), croppedImg) elif obj.getLastInstant() == frameNum: objects.remove(obj) frameNum += 1