First, the RGB-type for the human pattern recognition part:
rgbimage = imac.convert("RGB")
areacol = rgbimage.getpixel((imsize[0] - 1, imsize[1] - 1))
for provenpix in provenpixels:
rgbimage.putpixel(provenpix, (0, 200, 200))
for stillunprovpix in remainingunclear:
rgbimage.putpixel(stillunprovpix, (200, 200, 0))
for stillunprovpix in remainingunclear:
rgbimage.putpixel(stillunprovpix, (255, 0, 0))
rgbimage.show()
print "Is this a border pixel? It has the coordinates: ", stillunprovpix
while True:
pixelinfo = raw_input("yes (y) or no (n)? ")
if pixelinfo in ("y", "ye", "yes"):
provenpixels.append(stillunprovpix)
rgbimage.putpixel(stillunprovpix, (0, 125, 125))
break
elif pixelinfo in ("n", "no"):
rgbimage.putpixel(stillunprovpix, areacol) # remove mark
break
Second...As I said, the code does mostly what you propose.
Only this part I don't understand:
(Feb-18-2017, 04:58 AM)Skaperen Wrote: it probably depends on what the boundary is to be used for and how it will be used to make these decisions.
If "1-Pixel-border" is only what I assume it to be, there is no difference depending on the usage. It's just a question of "is this pixel one that makes the demarcation between the both colour regions?"
And if you like to think about patterns: How would you solve a region like this in universal rules? I was not able to get a "full" solution.
Bit of ASCII art, "x" is black (background color) and "-" is blue (area colour):
xxxxxxxxxx-
xxxxxxx----
---xxxxx---
--xxxxxxx--
--xxxxxxx--
---xxxxxx--
-----------
With checking a maximum of 8 neighbours, I was able to prove the border state of a couple of pixels, shown here as "o":
xxxxxxxxxxo
xxxxxxxoo--
oooxxxxxo--
--xxxxxxx--
--xxxxxxxo-
---oxxxxx--
----oooo---
Switching to "o" for the pixels with unproven border state:
xxxxxxxxxx-
xxxxxxx--o-
---xxxxx---
--oxxxxxxo-
--oxxxxxx--
---xxxxxxo-
--------o--
I fear one has to widen up the range of neighbours to a total of at least 15 for those...