Imagine having an array of images like these
Background is always white(even in the 3rd pic, main object there is that big brown rectangle with shapes inside)
No matter of given type of the image you would need to: 1) find main object boundary rectangle 2) crop it out like this
3) and place it in the center of a blank square image.
How would you achieve this? I already know how to crop out anything knowing rectangle and place it anywhere but I just need to know which way would be the best to make the 1st step. Vision API can detect rectangles, faces and barcodes, but it seems what I need is even more simple. I just need to find leftest, rightest, top and bottom non-white pixels and it will be my bounds. Is there any way except iterating pixelBuffer for each pixel?