Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Grégoire PETIT
DataScience
Commits
eb6bf2d6
Commit
eb6bf2d6
authored
Dec 05, 2018
by
Grégoire PETIT
Browse files
clean up
parent
3e6e953d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Challenge3/code/challenge3.py
View file @
eb6bf2d6
...
...
@@ -41,53 +41,6 @@ def getAltXY(pixel):
return
(
getAltitude
(
rgbValues
))
"""# -*- coding: utf-8 -*-
from PIL import Image
import numpy as np
import mpl_toolkits.mplot3d
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from math import atan, pi
from matplotlib import pyplot
#input_filename_altitude="D:/documents/IMT/datascience/challenge3/moodle/elevation1x1_new-mer-bleue_deforme.bmp"
input_filename_altitude="../moodle/elevation1x1_new-mer-bleue_deforme.bmp"
im_alt = Image.open(input_filename_altitude)
#input_filename_poputation="D:/documents/IMT/datascience/challenge3/moodle/population-density-map.bmp"
input_filename_poputation="../moodle/population-density-map.bmp"
im_pop = Image.open(input_filename_poputation)
# This modules gives useful informations
width=im_alt.size[0]
heigth=im_alt.size[1]
print("width = ",width)
print("heigth = ", heigth)
# To plot an histogram
pix_mont_blanc=im_alt.getpixel((1573,1593))
pix_sea_level=im_alt.getpixel((929,1666))
pix_sea=im_alt.getpixel((1,1))
print(pix_sea,pix_sea_level,pix_mont_blanc) #rgb
def getAltitude(rgbValues):
if rgbValues==(255,255,255):
res=0 #il y aura un effet sur les bord de la carte car sur la jonction les pixels ne sont pas parfaitement blanc
else:
R,G,B=rgbValues
res=4810/7921*(G-186)**2
return(res)
def getAltXY(pixel):
'''Permet d'avoir l'altitude réelle pour un pixel'''
rgbValues=im_alt.getpixel(pixel)
# print("rgbValues = ", rgbValues)
return(getAltitude(rgbValues))"""
def
getPopXY
(
pixel
):
'''Permet d'avoir la population réelle pour un pixel'''
pop_max
=
3000
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment