I wrote an extension method which returns me 2-dimensional array of YUV values from a bitmap i.e.:
public static YUV[,] ToYuvLattice(this System.Drawing.Bitmap bm)
{
var lattice = new YUV[bm.Width, bm.Height];
for(var ix = 0; ix < bm.Width; ix++)
{
for(var iy = 0; iy < bm.Height; iy++)
{
lattice[ix, iy] = bm.GetPixel(ix, iy).ToYUV();
}
}
return lattice;
}
Then I need to extract sets with the same U and V components. I.e. Set1 contains all [item1;item2] pairs, Set2 conatains [_item1;_item2] pairs. So I want to get List of Lists.
public IEnumerable<List<Cell<YUV>>> ExtractClusters()
{
foreach(var cell in this.lattice)
{
if(cell.Feature.U != 0 || cell.Feature.V != 0)
{
// other condition to be defined
}
// null yet
yield return null;
}
}
I started with above code but I stuck with condition to distinct values.
It sounds like you have an equivalence relation and you want to partition the data. By equivalence relation, I mean:
If that is what you have then this should work.
Usage: