0

Hi guys and thank you for your help. I need to find only rectangles that have not white pixels inside them, WITHOUT USING LIBRARIES...

In the img there are only white and black pixels , the rectangles are composed only by white pixels and the rest is black.

This is an example : IMG

And this is the result that the function should return: SOLUTION

I can use only the commands "load" and "save".

you can save the img and use the load command and you will see that the img is a list of list , where each list is a row , and each element of the list is each pixel of the row.

I found all the coordinates of the white pixels and i am searching for a solution to find the rectangles ..

img=immagini.load("e1_f1.png")
white=[]
white2=[]

for x, y in enumerate(img):

    for x1, y1 in enumerate(y):

        if (255,255,255) == y1:

            white2.append((x, x1))

white=[x[::-1] for x in white2]
Nuclearz
  • 25
  • 6
  • 1
    Possible duplicate of [Detecting rectangles (sub-arrays of same element value) in 2-d list](https://stackoverflow.com/questions/36668750/detecting-rectangles-sub-arrays-of-same-element-value-in-2-d-list) – Steven Kryskalla Nov 30 '18 at 17:39
  • Is not the same sir.. i neef first to solve without using libraries and this excercise is different from the one you mentioned – Nuclearz Nov 30 '18 at 22:39

0 Answers0