Q
Q
qwertand2019-10-12 13:49:06
Python
qwertand, 2019-10-12 13:49:06

How to apply a grid to an image (split the image into parts)?

Good afternoon!
I'm trying to apply a grid to the image (with a step of 30 pixels):

for r in range(0, img.shape[0], 30):
    for c in range(0, img.shape[1], 30):
        cv2.rectangle(img, (r, c), (r+30, c+30), (0, 0, 0), 2)

The problem is that the grid doesn't "reach" the end of the image (any).
I don't understand why is that?
5da1aeb352768586694102.png
(In the future, I plan to process each of the received cells in a special way, that is, plt.grid() and the like are not for this task)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Dugin, 2019-10-12
@qwertand

Did you skip math at school?
Well, so as not to get up twice:
5da1d13045e49100910322.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question