Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script to detect and select simple shapes?
#5
Ok, so the question you are asking is a typical one for computer vision, so maybe you should learn Python (which is very easy if you already have programming experience) and check the openCV library.

With Gimp, I would try this:
  • The color selection can use a RGB color but also tint, hue, saturation, lightness, or any of the RGB channels, all with a threshold.
  • From a selection you can obtain a path. This will rarely be exactly 4 points in a square, even if the shape is rectangular
  • From the path anchors you can determine corners (extremums on X/Y)
  • From these 4 corners you can create a selection a bucket-fill a layer
  • From the initial path you can obtain a selection and bucket-fill another layer
  • You put the top layer in Difference mode and merge the layer. The resulting layer is a map of the differences
  • With the histogram function you can have the pixel count of the difference and see how big that is relative to the square
Now out to hide the pool in my backyard.
Reply


Messages In This Thread
RE: Script to detect and select simple shapes? - by Ofnuts - 09-22-2024, 08:13 AM

Forum Jump: