Consider an image (img) as

enter image description here

There are six different textures in the image and I want to segment them using region splitting and merging. The property that I wish to consider (feel free to recommend alternatives) is: mean - variance or MeanEuclideanDistance.

How can I proceed?

  • $\begingroup$ You should know what parameters and their values used in each image partition to split and then merge. $\endgroup$ – José Antonio Díaz Navas Jan 23 '18 at 18:51
  • $\begingroup$ @JoséAntonioDíazNavas I know this. you may choose any random parameter and its values for splitting and merging. I am willing to have a framework to start with. $\endgroup$ – Majis Jan 23 '18 at 19:11
  • $\begingroup$ Is "region splitting and merging technique" the name of an algorithm or does it mean that you want to take the image apart and then put it together again? $\endgroup$ – C. E. Jan 24 '18 at 5:36
  • $\begingroup$ @C.E. "Region splitting and merging" is a standard technique for image segmentation. See this link (users.cs.cf.ac.uk/Dave.Marshall/Vision_lecture/node34.html). $\endgroup$ – Majis Jan 24 '18 at 8:21
  • 1
    $\begingroup$ @C.E. The question is updated. Thanks. $\endgroup$ – Majis Jan 24 '18 at 9:20
img = Import["D:\\Tmp\\test.jpg"]
id = ImageData[img];

enter image description here

It is evident, that simple parameter that allows distinguishing of the image segments here is something like Variance or StandardDeviation of pixel intensity. Let's try to scan image with Variance:

yt = Variance /@ id[[All, All, 1]];
xt = Variance /@ Transpose@id[[All, All, 1]];

st = {Joined -> True, ImageSize -> 300, PlotRange -> All};
  ListPlot[xt, st],
  ListPlot[yt, st]

enter image description here

Thus, just look for thresholds:

xd = {}; yd = {};
 If[Abs[xt[[i + 1]] - xt[[i]]] > 0.6*xt[[i]], AppendTo[xd, i]],
 {i, 2, Length@xt - 1}]
 If[Abs[yt[[i + 1]] - yt[[i]]] > 0.6 yt[[i]], AppendTo[yd, i]],
 {i, 2, Length@yt - 1}]

{xd, yd}

{{225}, {150, 300}}

ImagePartition[img, {xd, yd[[1]]}] // Grid

enter image description here


I would first partition the image by using a UI to limit regions. Then, perform a weighted Kalman filter for each region.

You can then apply the filter data to each part of the image resizing until the AI finds 'trusted' areas. From this uncertainty can be unblocked by using smaller regions against the filter data until every pixel is accounted for.

Also, I would suggest that if this is one frame in a movie, you now know the relative coordinates for each region so can apply each 1 frame forward and also 1 frame back. This way the relative neighbours form the overall matrix for the image, not the image object boundaries.

  • 1
    $\begingroup$ Can you provide a Mathematica code? $\endgroup$ – Kuba Jan 27 '18 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.