Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes flipped up image in draw_display() to work in Debian #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pygazeanalyser/gazeplotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ def draw_heatmap(fixations, dispsize, imagefile=None, durationweight=True, alpha
heatmap[y:y+gwh,x:x+gwh] += gaus * fix['dur'][i]
# resize heatmap
heatmap = heatmap[strt:dispsize[1]+strt,strt:dispsize[0]+strt]

retheatmap = numpy.copy(heatmap)

# remove zeros
lowbound = numpy.mean(heatmap[heatmap>0])
heatmap[heatmap<lowbound] = numpy.NaN
Expand All @@ -240,7 +243,7 @@ def draw_heatmap(fixations, dispsize, imagefile=None, durationweight=True, alpha
if savefilename != None:
fig.savefig(savefilename)

return fig
return (fig, retheatmap)


def draw_raw(x, y, dispsize, imagefile=None, savefilename=None):
Expand Down Expand Up @@ -391,7 +394,9 @@ def draw_display(dispsize, imagefile=None):
# flip image over the horizontal axis
# (do not do so on Windows, as the image appears to be loaded with
# the correct side up there; what's up with that? :/)
if not os.name == 'nt':
# (In Linux, the image is also loaded with the correct side up,
# so there's no need to flip it)
if not (os.name == 'nt' or os.name == 'posix'):
img = numpy.flipud(img)
# width and height of the image
w, h = len(img[0]), len(img)
Expand Down