I want to separate 2 clusters in image. First cluster should be white, second should be black. I have two questions:
When I use MatrixPlot function, I found some orange pixels. Why I have been found them? There are only 2 clusters: 1 - black, 2 - white. More you can see on the photo. Code is there
file = Import["D:\\Mathematica\\0.jpg"]; dataImage = ImageData[file]; listClust = ClusteringComponents[dataImage, 2, 2]; MatrixPlot[listClust, ColorRules -> {1 -> White, 2 -> Black}]
How can I drow Image without using MatrixPlot. I have tryed something like this
image2Clusters = Image[listClast]; image3Clusters = Image[newClustersList]; Colorize[image2Clusters] Colorize[image3Clusters]
but there are only blue background. Nothing else.
Could you run Union@Flatten@listClust just to make sure there are only 1s and 2s in the output? Also, try ArrayPlot[listClust, ColorRules -> {1 -> White, 2 -> Black}].
Union@Flatten@listClust
Can you post original image? We do not have your "D:\" drive ;-)