Created
April 4, 2018 09:23
-
-
Save nithikan/1c7e77b62ee54f90f30c169df61a1e16 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### Assignment 2-2 Center point of the crowd in each image | |
##### -> Accumulate x and y positions and divide by person count | |
##### 04/04/2018 | |
##### Nithikan Srinakrung - Bam | |
##### DF4, FTSM, UKM | |
import os,sys | |
import scipy.io as sio | |
import numpy as np | |
foldername = '.' | |
filtername = 'mat' | |
foldercontents = os.listdir(foldername) | |
filteredcontents = [i for i in foldercontents if i.split('.')[-1] == filtername] | |
#print(filteredcontents) | |
for i in filteredcontents: | |
filename = "D:/Coop/UCF_CC_50/" + str(i) | |
data = sio.loadmat(filename) | |
xPoint = [] | |
yPoint = [] | |
for j in data["annPoints"]: | |
print (str(i) + " x " + str(j[0]) + " y " + str(j[1])) | |
xPoint.append(j[0]) | |
yPoint.append(j[1]) | |
sumX = np.sum(xPoint) | |
sumY = np.sum(yPoint) | |
print('********************************** center coordinates x: ' + str(sumX / len(xPoint)) + " y " + str(sumY / len(yPoint)) ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment