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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:24:17+00:00 2026-05-11T09:24:17+00:00

I am working on an idea wherein I have to identify lines in a

  • 0

I am working on an idea wherein I have to identify lines in a JPG or PNG file. The PNG file contains one graph of a single value – one x,y combination. For example, the graph looks like Y = mx+c. I would like to identify the line in the graph – if I can indentify the position of the pixel in the frame, I believe I can get back the values (x,y) which were used to plot the graph. The assumptions here is – I know the scale i.e 1 pixel = what unit of Y ? Can somebody please help me to write a code which will identify the pixels of a specific color in one PNG file?

EDIT

Lets take an example to make it clear. Lets say I have a set of data values X and Y like this –

X = 1, Y = 10 X = 2, Y = 20 X = 3, Y = 30 X = 4, Y = 40 X = 5, Y = 50 X = 6, Y = 60 

In this case, if I use jfreechart type of charting tool and make a chart, it tools like a straight line.

So the input is the dataset and output is the .PNG file (using jchart or jfreechart) containing this line graph for Y values.

Question is – if we reverse the flow, can we develop one program which will take the PNG file (that contains the graph) and give me back the dataset.

The context of the problem is — I want to store the PNG files in my application and not the raw dataset. But given a PNG file, I should be able to get back my dataset.

  • 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. 2026-05-11T09:24:18+00:00Added an answer on May 11, 2026 at 9:24 am

    I’m a bit confused as to whether your problem is simply determining the colour of pixels in an image, or if the problem is the mathematics of what you’re trying to do.

    For the former, do something such as the following:

        BufferedImage bimg = ImageIO.read(new File('whatever.png'));      // get the colour of the pixel at position (x, y)     int col = bimg.getRGB(x, y);      // decode red, green and blue components of colour if necessary     int r = (col >> 16) & 0xff;     int g = (col >> 8) & 0xff;     int b = col & 0xff; 

    If from the graph you just want to get back the dataset (i.e. not derive an equation from that data), then you essentially loop through each X position and find the Y position where there’s a pixel of the colour that the graph plotting program uses. If the graph has axes, antialiasing etc, then the task will be more complex.

    The task of deriving an equation from the data is potentially much more complex, but you can start by checking for certain suspected formulae such as y = mx + c as you mention. For example, you can loop through checking the difference between each Y position for the last; if that difference is always the same, then you’ve got a straight line graph (and at that point, deriving the formula should be trivial).

    For testing for other equations, it helps to know a bit of calculus. Then, a starting point is to see if the differences in the differences match the derivative for the equation in question. (Just as an example, if the equation is y = ax^2 + c, then for every increase in X, the increase in Y will itself increase by 2a.)

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

Sidebar

Related Questions

I'm working through an idea for an iphone app. One of the tech requirements
Any idea why the following code is not working mysql credentials are correct, have
Im working on a small application to try out an idea that I have.
Anyone have any idea why my jQuery carousel is working fine at the bottom
I do not have a smart or at least working idea how to solve
I would like to start working on an idea I have for an iphone
I am new to android so have very less idea about working of images
I have been working on this idea of how to plot about 50 routes
Is a mocking framework a good idea for working with several physical devices, and
Working with IDE like NetBeans or IDEA, i've seen that they are converting generic

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.