-1

What I'm trying to achieve

  1. A Bitmap that is filled with triangles.
  2. The triangles' separation depends on if the color change from one pixel to the next is too much.
  3. The color of each triangle depends on the median color value from the entire area of pixels inside of the triangle.

What I'm struggling with
Finding the best way to check for triangles under this condition.

What I've thought of but couldn't succeed

  1. Have a nested loop that checks for each pixel color by row and column of the bitmap, if it's a drastic change start going down, else go down-left, etc.
  2. Color every part on the Bitmap that has relatively the same color through Lists. Make triangles later.

Anything would be helpful, I can provide my current code if needed also a drastic color change is measured based on the tolerance variable

Edit
Picture before process
Picture after process
So I'd like to make a bitmap of an image (which I've done) and have the code color over that bitmap based on the conditions I layed out. The after process picture is basically what would happen if the tolerance variable is very high, but in general the triangles should be way smaller to perform finer color transitions. Thanks

Ripi2
  • 7,031
  • 1
  • 17
  • 33
Aven 3rYU
  • 3
  • 2
  • 1
    Are you trying to _generate_ "a Bitmap that is filled with triangles", or colour it, or detect it somehow? This is really not clear. – Nyerguds Apr 07 '20 at 14:21
  • 1
    Can you post images with original & final bitmaps? Sketches are enough. – Ripi2 Apr 07 '20 at 17:20
  • @Ripi2 I have added pictures to hopefully better clarify my intentions. Don't mind that some of the second one isn't filled in, just imagine it kept the pattern going. – Aven 3rYU Apr 07 '20 at 22:32
  • @Nyerguds I am trying to do all of those, I need to use the color condition I have to detect where a triangle needs to go to lapse over that color, then on the Bitmap color that area with that median color so instead of varying colors in the area it's just one. Then repeat that until the entirety of the Bitmap is full of triangles and there are no pockets to the original image left. – Aven 3rYU Apr 07 '20 at 22:34
  • Wait, you're trying to paint over an _existing_ image in triangles? That is so absolutely not clear. And why triangles? They are so messy to work with in raster images. – Nyerguds Apr 07 '20 at 22:36
  • @Nyerguds Well I'm mainly troubleshooting right now, I don't need to color over an image but I thought it might be easier to do so for when I check if a triangle was already in an area. I thought of making 4 sided polygons cut in half to form triangles. But I do need them to be a triangle. I'm trying to make this program generate low poly art style versions of the image put in. (Specific style I wish for requires triangles) – Aven 3rYU Apr 07 '20 at 22:47

1 Answers1

0

The way I understand your goal is using the "drastic color change" technique -if you're able to define it correctly- to figure out edges of triangles.

Then, with these edges and some isolated points you could do a constrained triangulation, usually a Constrained Delaunay Triangulation (CDT).

Shewchuk has good papers about this CDT. And also a free program Triangle in C. Perhaps you find some "clone" in C# or .net

Ripi2
  • 7,031
  • 1
  • 17
  • 33