I have an image, then the goal is to detect large rectangles of the same color within an image.
So if an image is uploaded with a square picture of a duck on the left, and a square picture of another duck on top, the largest rectangle can be found toward the bottom right side.
Here is what I know so far:
Jimp.read("imagepath", function (err, image) {
image.getPixelColor(x, y);
});
What I think I should do somehow to accomplish this, is:
Jimp.read("imagepath", function (err, image) {
for(var x = 0; x < Jimp.Pixel.Length?; x++) {
for(var y...) {
image.getPixelColor(x, y);
}
});
So somehow converting the image into an array of pixels that is like a 2d array. Then going through the array and using code to find patterns that match a rectangle.