I have extracted the co-ordinates of the non-rectangular(blob) region from the image, and simply appended it to a list,
cup_roi_hull = []
for cord in cup_roi_coordinates:
cup_roi_hull.append(orig_img[cord[0], cord[1]])
then converted it to numpy array,
cup_roi_hull = np.array(cup_roi_hull)
now i want to apply either k-mean segmentation or superpixel segmentation on this numpy array, and i have successfully applied superpixel segmentation on the array,
segments = slic(img_as_float(cup_roi_hull), n_segments=18, sigma=5)
but here the issue is the cup_roi_hull here is 1-dimensional array with depth 3(as expected),
print cup_roi_hull.shape
(13504, 3)
so after this i have to make binary decision on each segments using pre-trained SVM model, and will classify the curresponding segment region(x,y co-ordinates) over orignal image, but as here the cup_roi_hull is 1D flattened array, it can't be mapped to original images which is 2D matrix array.
So, my question, is it possible to transform this 1D array into 2D matrix array in the form of rows and columns, or is there any other way to map or track the segmented array (cup_roi_hull) values to original image's co-ordinate array matrix, so it can be then classified and highlighted in the original image.