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 8882339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:33:12+00:00 2026-06-14T20:33:12+00:00

How to get an array of coordinates of a (drawn) line in image? Coordinates

  • 0

How to get an array of coordinates of a (drawn) line in image? Coordinates should be relative to image borders. Input: *.img . Output array of coordinates (with fixed step). Any 3rd party software to do this? For example there is high contrast difference – white background and color black line; or red and green etc.

Example:
enter image description here

  • 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-14T20:33:13+00:00Added an answer on June 14, 2026 at 8:33 pm

    Oh, you mean non-straight lines. You need to define a “line”. Intuitively, you might mean a connected area of the image with a high aspect ratio between the length of its medial axis and the distance between medial axis and edges (ie relatively long and narrow, even if it winds around). Possible approach:

    • Threshold or select by color. Perhaps select by color based on a histogram of colors, or posterize as described here: Adobe Photoshop-style posterization and OpenCV, then call scipy.ndimage.measurements.label()

    • For each area above, skeletonize. Helpful tutorial: “Skeletonization using OpenCV-Python“. However, you will likely need the distance to the edges as well, so use skimage.morphology.medial_axis(…, return_distance=True)

    • Do some kind of cleanup/filtering on the skeleton to remove short branches, etc. Thinking about your particular use, and assuming your lines don’t loop around, you can just find the longest single path in the skeleton. This is where you can also decide if a shape is a “line” or not, based on how long the longest path in its skeleton is, relative to distance to the edges. Not sure how to best do that in opencv, but “Analyze Skeleton” in Fiji/ImageJ will let you filter by branch length.

    • What is left is the most elongated medial axis of the original “line” shape. You can resample that to some step that you prefer, or fit it with a spline, etc.

    Due to the nature of what you want to do, it is hard to come up with a sample code that will work on a range of images. This is likely to require some careful tuning. I recommend using a small set of images (corpus), running any version of your algo on them and checking the results manually until it is pretty good, then trying it on a large corpus.

    EDIT: Original answer, only works for straight lines:

    You probably want to use the Hough transform (OpenCV tutorial).

    Python sample code: Horizontal Line detection with OpenCV

    EDIT: Related question with sample code to skeletonize: How can I get a full medial-axis line with its perpendicular lines crossing it?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<?php $filename=vast/Vastopolis_Map.png; $image = imagecreatefrompng($filename); // get properties of the image as an array
I'm trying to empty an array containing my drawn coordinates when a button clear
I have 2D array but if I change x coordinate, everytime I get wrong
I need to get array of images that have to call from server and
How in C++ get array length with pointers only ? I know that tab
How to get array data from json in c#? Here is the ajax code
Is there a simple way to get array of all index paths for the
Please tell me how can I get array of all Those DIV of specific
Scenario: If there is an array of integers and I want to get array
get an array of bluetooth ID's Broadcast the bluetooth signal manually

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.