I am working on a school project on image segmentation and object recognition and am trying out conditional / markov random fields on superpixels. getLabels() returns a Mat where pixels belonging to the same superpixels are assigned the same integer for eg. from 0 to 1000. So I now have a 1D vector where each vector contains the mean coordinate of each superpixel.
However, since the structure of CRFs/MRFs in image processing are in a "2D" layout, Id like to reorganize the superpixels into a 2D array where neighbouring contents signify adjacent superpixels but am having a lot of problems doing so even if I have the mean of the xy coordinates of each superpixel.
I was hoping someone would have a suggestion on how I can achieve this.