Skip to content

Instantly share code, notes, and snippets.

@luiseduardogfranca
Last active April 26, 2018 01:48
Show Gist options
  • Save luiseduardogfranca/af61a3296fd72b0d40c9bce8cdceb2df to your computer and use it in GitHub Desktop.
Save luiseduardogfranca/af61a3296fd72b0d40c9bce8cdceb2df to your computer and use it in GitHub Desktop.
def extremeValues(mask):
element_x = []
element_y = []
for coord in mask:
element_x.append(coord[0])
element_y.append(coord[1])
# (minX, maxX, minY, maxY)
return (min(element_x), max(element_x), min(element_y), max(element_y))
def areaOfInterest(extremeValues, image):
minX = int(extremeValues[0])
maxX = int(extremeValues[1])
minY = int(extremeValues[2])
maxY = int(extremeValues[3])
print(type(minY))
area = [[image[i, a] for a in range(minY, maxY + 1)] for i in range(minX, maxX + 1)]
return area
def print_array(array):
for i in range(len(array)):
for j in range(len(array[0])):
print(array[i][j], end = " ")
print()
@SilvaEmerson
Copy link

SilvaEmerson commented Apr 26, 2018

Acho que area = [[ imagem[i, a] for a in range(minY, maxY + 1)] for i in range(minX, maxX + 1)], sendo que imagem é a imagem original, que vc pode passar como parâmetro.

@luiseduardogfranca
Copy link
Author

good idea!

@luiseduardogfranca
Copy link
Author

ready! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment