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

  • Home
  • SEARCH
  • 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 7770439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:24:39+00:00 2026-06-01T16:24:39+00:00

I had load buffered image and need to plot histogram? please suggest me next

  • 0

I had load buffered image and need to plot histogram? please suggest me next steps to to plot
RGB histogram. if it can done using jai please suggest me the way to do it. I hadtried alot and also googled alot but dint found any right solution.
here is how i had load my image please provide me next steps

    BufferedImage   image= ImageIO.read(new File("C:\\Images\\Sunset.jpg"));             

    ParameterBlock pb = new ParameterBlock();

    int[] bins = { 256 };
    double[] low = { 0.0D };
    double[] high = { 256.0D };

    pb.addSource(image);
    pb.add(null);
    pb.add(1);
    pb.add(1);
    pb.add(bins);
    pb.add(low);
    pb.add(high);

    RenderedOp op = JAI.create("histogram", pb, null);
    Histogram histogram = (Histogram) op.getProperty("histogram");
  • 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-01T16:24:40+00:00Added an answer on June 1, 2026 at 4:24 pm
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.image.BufferedImage;
    import java.awt.image.RescaleOp;
    import java.io.IOException;
    import javax.media.jai.JAI;
    import javax.media.jai.PlanarImage;
    import javax.swing.*;
    
    public class FinalHistogram extends JPanel {
    
        int[] bins = new int[256];
        FinalHistogram(int[] pbins) {
            bins = pbins;
            repaint();
        }
    
        @Override
        protected void paintComponent(Graphics g) {        
            for (int i = 0; i < 256; i++) {
                System.out.println("bin[" + i + "]===" + bins[i]);
                g.drawLine(200 + i, 300, 200 + i, 300 - (bins[i])/1000);
            }
        }
    
    
        public static void main(String[] args) throws IOException {
            JFrame frame = new JFrame();
            frame.setSize(500, 500);
            int[] pbins = new int[256];
            int[] sbins = new int[256];
            PlanarImage image = JAI.create("fileload", "image12.tiff");
            BufferedImage bi = image.getAsBufferedImage();    
            System.out.println("tipe is          " + bi.getType());
            int[] pixel = new int[3];
    
            int k = 0;
            Color c = new Color(k);
            Double d = 0.0;
            Double d1;
            for (int x = 0; x < bi.getWidth(); x++) {
                for (int y = 0; y < bi.getHeight(); y++) {
                    pixel = bi.getRaster().getPixel(x, y, new int[3]);
                    d=(0.2125*pixel[0])+(0.7154*pixel[1])+(0.072*pixel[2]);
                    k=(int) (d/256);
                    sbins[k]++;
                }
            }
            System.out.println("copleted" + d + "--" + k);
            JTabbedPane jtp=new JTabbedPane();
            ImageIcon im= new ImageIcon(bi);
            jtp.addTab("Histogram",new FinalHistogram(sbins));
            frame.add(jtp);
            frame.setVisible(true);
            frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i Had load my image Buffered image now need to brighten it using Slider
I had a image but cant up load it yet AHH I was able
I'm using the HTML5 canvas to load a single instance of an image which
EDIT:I've changed the title, because the issue had nothing to do with IE image.load()
I am using codeigniter for my website.i had a situation to load a view
I've written a program in Haskell which had to load and parse big text
How do you load an HTML DOM document into Scala? The XML singleton had
Had a good search here but can't see anything that gets my mind in
I want to show a pop up on page load and had a checkbox
I'm using a function to lazy-load the Sizzle selector engine (used by jQuery): var

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.