shape withing shape detection with opencv

I would like to use opencv for shape detection. I tried the code from this: How to detect simple geometric shapes using OpenCV but it does not detect overlapping shapes or shape within shape.

Can someone recommend an approach with opencv for finding shapes within shapes and overall better detection of different sizes of shapes. I am hoping to code in python.

Below is an example image that has example shapes that I would like to detect.

<img src="https://i.stack.imgur.com/VFTNz.jpg" alt="enter image description here">


You can first detect all edges using Canny Edge Detector.

Then you can apply suitable shape fitting method to the detected edges. Check out Structural Analysis and Shape Descriptors for more info.


  • Dynamic programming matrix chain multiplication
  • What icons required for app to submit to MAC App Store?
  • Submitting two different forms with an external Submit button not working properly
  • String not fitting in label which is in a subview for swift
  • How to realize with WinForms in C# something like an image with map areas in a homepage (at hooverin
  • Git Merge Adds New File Instead of Conflict Markers - CONFLICT (rename/add)
  • Can't open HTTP stream: Error opening file (../cap_ffmpeg_impl.hpp:529)
  • Multiple Layouts Previews for Android in Eclipse
  • How to apply a partial derivative Gaussian kernel to an image with OpenCV?
  • SQL Server Integrated Security from an Azure Web Site
  • Efficiently getting XML into Elasticsearch
  • Furthest-point Voronoi diagram in Java
  • Mapping two workspace folders to the same working directory
  • How to best manage SMTP clients
  • Swift iOS don't recognize GCM library imports?
  • Negating Regex PO BOX
  • Using android opencv apps without downloading opencv sdk manager
  • Merge Module leaving files during uninstall
  • import scipy.sparse failed
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • UWP/C# - Issue with AQS and USB Devices
  • where do I find the xml.dom python package for the python-2.6.0-8.9.28 and I have a suse/x86_64 vers
  • How to make JSON.NET deserialize to Microsoft Date Time?
  • Python pickle not one-to-one: different pickles give same object
  • Redirect STDERR in OPEN pipe comand. Perl Linux
  • Create DicomImage from scratch using Dcmtk
  • Declaring variable dynamically in VB.net
  • one Local Olampyad Questions on Informatic in 2011
  • How to do unit test for HttpContext.Current.Server.MapPath
  • When to use `image` and when to use `Matrix` in Emgu CV?
  • Exchange data b/w iOS devices using Bluetooth 4.0
  • Finding past revisions of files in StarTeam w/ .NET SDK / C#
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • retrieve vertices with no linked edge in arangodb
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How does Linux kernel interrupt the application?
  • How can I remove ASP.NET Designer.cs files?
  • java string with new operator and a literal
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize