Android Question Fill color boxes automatically.

vecino

Well-Known Member
Licensed User
Longtime User
Hello, is it possible or not possible?

The user uploads an image.
The software "finds" the boxes and filled with color.
The software saves the new image.

Impossible?

User image:
vacio.png


Generated image:
lleno.png
 

vecino

Well-Known Member
Licensed User
Longtime User
The number of polygons: 20 to 40
No, I do not know where they are, it is random.

Thank you, friends :)
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
You can also do the scanning smarter. Remember how far you scanned last time before finding a white pixel, and resume from that point the next time.

right, that's what I meant with storing the last position ;)

but then we are mainly putting our focus on this simple squared example, if you start with small rotated blocks and triangles etc it won't jump much forward I guess.

It's a trial and error thingy.
 
Upvote 0

Troberg

Well-Known Member
Licensed User
Longtime User
It doesn't matter what shape they have or how large they are. The thing is, whatever way you turn it, each pixel needs to be tested once. Storing the position simply makes sure it's not tested more than once.

Also, flood fills usually is faster for smaller areas, basically, the speed per pixel is fixed.

In other words, regardless of the number of shapes, it boils down to:

* All pixels must be scanned once.
* All white pixels must be filled once.

You can't get away from that, and I'm pretty sure that my method is about as effective as it gets.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
Maybe Erel should make a coding compo for it, different ideas equals to different excution times so it can be an interesting mini coding project with surprising results.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
I think there should be a "game of life". Check the white pixels around until all are black. Then find another white pixel and repeat the process.
But how can I do it?
 
Upvote 0
Top