Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9190411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:27:17+00:00 2026-06-17T20:27:17+00:00

I have an image file with a graph in it. For instance: How can

  • 0

I have an image file with a graph in it. For instance:
USA map

  1. How can I efficiently extract this graph? Could you point me some examples/concepts?

  2. I have a data file containing the edge details and I could plot them on a map to create an image (like the one shown in the link) but with a different background. How can I compare the two and say that there is a match/mismatch?

Any help/comments/thought is much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:27:19+00:00Added an answer on June 17, 2026 at 8:27 pm

    Since this can be hardly replicated for different images, this is only a overview of something that works for this specific image.

    First convert your image to CMYK and consider the third channel (‘Y’) to binarize (80% of max, your vertices are relative yellow) to find the vertices:

    enter image description here

    Now consider the second channel (‘M’) to binarize (80% of max again) to find the edges:

    enter image description here

    Now if you consider each vertex as a connected component and each edge as connected components too, then you can construct a graph simply by considering the both images at the same time and taking into consideration which edges a given vertex touches.

    You can now convert your input image to grayscale in order to find the text. In this simple image, some ad-hoc connected component analysis and simple threshold will give all the text:

    enter image description here

    If I run some pretty basic text recognition on this last image, I get:

    Seattle
    Chicago
    Bay Area DC Metro NYC
    Denver
    Los
    Angeles
    Phoenix
    

    Which is pretty nice since it found all the text. All that is left is giving names to your vertices in the already built graph. To do that, consider where a block of text appears and proceed to find the closest edge (first image, just a euclidean distance to the centroids).

    If it matters, here is the code to obtain these results:

    f = Import["https://i.stack.imgur.com/DP3la.png"]
    cmyk = ColorSeparate[f, "CMYK"]
    vertex = Binarize[cmyk[[3]], 0.8]   (* The first image *)
    edge = Binarize[cmyk[[2]], 0.8]     (* The second image *)
    nyctext = SelectComponents[
      DeleteSmallComponents[
       SelectComponents[Binarize[ColorConvert[f, "Grayscale"], 0.01], 
        Small]], "Length", #1 < 25 &]
    alltext = ImageAdd[
      SelectComponents[
       ColorNegate[Binarize[ColorConvert[f, "Grayscale"], 0.5]], Small], 
        nyc_text]                       (* The last image *)
    TextRecognize[alltext]              (* The text recognized *)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a raw image file that is saved in binary data (no encoding).
I have a custom image file where the first block of data is ASCII
I have an image file that has all the character sprites that I will
I have image and txt file of same size say 200 KB. Now i
I have an URI image file, and I want to reduce its size to
I have an image (PNG file) that has an alpha channel that is set
I have a image (png file) with opacity 35%, i want for example: Set
I have a single image file in a folder in my Eclipse project that
I have written a raw binary image file into a buffer which is an
I have a form that accepts image file, i want to be able to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.