Consider the following picture of a phase plane which help us distinguish between regular and chaotic motion. The entire phase plane is divided into two types of regions: (i) the regular domain corresponding to the different well-defined islands of closed curves and (ii) the chaotic domain corresponding to the randomly scattered black dots. So the question is the following: is there a computational way to measure the area of these two domains? Let's say 55% of the phase plane is chaotic and 45% is regular.

Many thanks in advance.

enter image description here


enter image description here

I want to calculate the portion inside the outermost star-like thick black curve occupied by the red circled white regions.


Some more examples

enter image description here enter image description here enter image description here enter image description here enter image description here

  • 1
    $\begingroup$ Do you have the equations that produced this pattern? $\endgroup$
    – paw
    Oct 12, 2014 at 10:05
  • $\begingroup$ @paw No, the equations of the patterns are unknown; in fact they do not exist. $\endgroup$
    – Vaggelis_Z
    Oct 12, 2014 at 12:39
  • 1
    $\begingroup$ @Vaggelis_Z, existence doesn't imply easy to compute or even computable. What's the class of dynamics, more detailed than just conservative (if that's the case). Do you have a Hamiltonian? Were the graphics computed pointwise vs curve following? $\endgroup$ Oct 12, 2014 at 16:48

1 Answer 1


Mathematica has a lot of image-processing functions. The proper combination of them will give you the desired result.

Loading and cropping:

$HistoryLength = 0;
img = Binarize@ImagePad[#, -{{340, 80}, {230, 60}}] &@

enter image description here

Erosion and removing small white components

img2 = SelectComponents[#, "BoundingDiskRadius", # > 50 &] &@ Erosion[img, DiskMatrix[2.5]]

enter image description here

Big chaotic brother is watching you! :)

Deleting holes and removing remaining small components.

img3 = SelectComponents[#, "BoundingDiskRadius", # > 45 &] &@
  Erosion[FillingTransform[img2], DiskMatrix[2.5]]

enter image description here

img4 = Dilation[img3, DiskMatrix[6]]

enter image description here

The mask of the full region

full = FillingTransform@ColorNegate@img4

enter image description here

The mask of the regular regions

regular = SelectComponents[img4, "Area", # < 3*^5 &]

enter image description here

The detected regions (hi-res)

ImageSubtract[img, ImageMultiply[regular, Darker@Cyan]]

enter image description here

The ratio of regular regions

Total[ImageData@regular, 2]/Total[ImageData@full, 2] // N


  • $\begingroup$ The proposed image-processing method works perfectly to this particular example (.jpg file). However, I tried it in other plots with less amount of chaos and the results are no longer good. I uploaded some more examples; see Edit 2. Is there a way to modify this method, so as to work well regardless the particular image file? Since the general idea is working I suppose it needs some fine tuning so as to be applicable to any image file. $\endgroup$
    – Vaggelis_Z
    Oct 12, 2014 at 19:33
  • $\begingroup$ @Vaggelis_Z Of course, the image-processing have certain limitations. It is difficult to tune it to process these images. The main problem is that lines in the regular regions are not solid. Could you modify your algorithm (if it is your plots) to produce solid lines? Or calculate so many point to join them. $\endgroup$
    – ybeltukov
    Oct 12, 2014 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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