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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:40:37+00:00 2026-06-06T13:40:37+00:00

I’m new in JavaCV and want to create a Histogram from a image. I

  • 0

I’m new in JavaCV and want to create a Histogram from a image.

I tried to translate some C++ code into Java but JavaCV don’t have methods like cvCVtPixToPlane.

Can someone help me to create a 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-06T13:40:39+00:00Added an answer on June 6, 2026 at 1:40 pm

    a translatet OpenCV-Code from the OpenCV-Wiki must be run.

    I give you my code snipet to create a 1D-Diagram from the h-channel:

    private CvHistogram getHueHistogram(IplImage image){
        if(image==null || image.nChannels()<3) new Exception("Error!");
        IplImage hsvImage= cvCreateImage(image.cvSize(), image.depth(), 3);
        cvCvtColor(image, hsvImage, CV_BGR2HSV);
        // Split the 3 channels into 3 images
        IplImageArray hsvChannels = splitChannels(hsvImage);
        //bins and value-range
        numberOfBins=255;
        float minRange= 0f;
        float maxRange= 180f;
        // Allocate histogram object
       int dims = 1;
       int[]sizes = new int[]{numberOfBins};
       int histType = CV_HIST_ARRAY;
       float[] minMax = new  float[]{minRange, maxRange};
       float[][] ranges = new float[][]{minMax};
        int uniform = 1;
        CvHistogram hist = cvCreateHist(dims, sizes, histType, ranges, uniform);
        // Compute histogram
        int accumulate = 1;
        IplImage mask = null;
        cvCalcHist(hsvChannels.position(0),hist, accumulate, null);
        return hist;
    }
    

    And my splitChannels-Method, i used in this snipet:

    private IplImageArray splitChannels(IplImage hsvImage) {
        CvSize size = hsvImage.cvSize();
        int depth=hsvImage.depth();
        IplImage channel0 = cvCreateImage(size, depth, 1);
        IplImage channel1 = cvCreateImage(size, depth, 1);
        IplImage channel2 = cvCreateImage(size, depth, 1);
        cvSplit(hsvImage, channel0, channel1, channel2, null);
        return new IplImageArray(channel0, channel1, channel2);
    }
    

    If you want to draw a picture from the histogram you can iterate the bins. With cvQueryHistValue_1D() you can get the sum of pixels from bin_i

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I want use html5's new tag to play a wav file (currently only supported
I want to construct a data frame in an Rcpp function, but when I
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

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.