Hi there, I am working on a project where I run a small autonomous car through a track. I have some experience with opencv but I just can’t wrap my head around how to solve this. The problem is, I have a binary image (a lane mask) and I want to get small non overlapping squares of SxS ‘on’ pixels, or more importantly the centroids of all such squares. In opencv I would probably just directly iterate through the numpy array but I understand that is not recommended here. Is there any way to do this? Please let me know if any additional info is required.
Some extra context in case there’s better ways to go about it, I am using something like pseudo vector field to navigate the car. I want each centroid to give it some sort of ‘push’ (magnitude and angle) based on its location in the frame. I already have done some preprocessing like perspective transform, lens correction as well as thresholding to detect lane lines (they’re colour coded in this context)
edit: I have also looked at find blobs but for this exact use case I’m not sure how to use it outside of running it on lots of small regions of interest which may be inefficient. I will also be working with low quality images QVGA or even QQVGA so there might be some leeway with efficiency but I have to repeat this process on at least three individual masks.