首页 > 解决方案 > Identify groups of numbers in an array (group pixels of an image)

问题描述

this question is related to another question i asked before here. now i have an array of contains 0s,1s,-1s. consider it as an image where background is 0s. i has groups of 1s and -1s. array in exel This it that array opened in excel. those highlighted groups are 1s( in some cases can be -1s). there can be 4 groups in one array maximum. i want to separate those groups in to left, right, top, bottom with its value and the original index. referring to the previous question, i am trying to find the points on the humps and hollows in the puzzle pieces. if i can group them separately then i know how to find the index of the point i want. i tried to separate like this. but this doesn't apply for all the pieces. some times it can cut through hollows. this thanks in advance for any help!!!

标签: pythonimagenumpyopencv

解决方案


Since your data is 2d array. Have you tried using an approach like region growing to segment the data?

https://en.wikipedia.org/wiki/Region_growing

Basically, you need to start with a seed point and grow the region by considering neighbouring points and whether or not they fit the criteria for your region.


推荐阅读