#22 développement du pourcentage de contamination
This commit is contained in:
@@ -1,5 +1,14 @@
|
||||
class_name ImageTools
|
||||
|
||||
static func get_color_coverage(image: Image, color: Color = Color.WHITE):
|
||||
var pixel_color_count = 0.
|
||||
for x in range(image.get_width()):
|
||||
for y in range(image.get_height()):
|
||||
if image.get_pixel(x, y) == color:
|
||||
pixel_color_count += 1.
|
||||
return pixel_color_count/(image.get_width()*image.get_height())
|
||||
|
||||
|
||||
static func draw_circle(image: Image, center: Vector2i, length: int, color: Color = Color.WHITE):
|
||||
for x in range(image.get_width()):
|
||||
for y in range(image.get_height()):
|
||||
|
||||
Reference in New Issue
Block a user