I am not getting a "histogram plot of image". This code gives only "image" in output. Give me the solution. [closed]

asked 2016-10-02 09:43:41 -0500

N gravatar image

updated 2017-12-24 10:55:13 -0500

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>

using namespace cv;
using namespace std;

/**  @function main */
int main(int argc, char** argv)
    Mat src, dst;
    char* source_window = "Source image";
    char* equalized_window = "Equalized Image";
    /// Load image
    src = imread("F:\\abc.jpg", 1);

    if (!src.data)
        cout << "Usage: ./Histogram_Demo <F:\\abc.jpg>" << endl;
        return -1;

    /// Convert to grayscale
    cvtColor(src, src, CV_BGR2GRAY);
    /// Apply Histogram Equalization
    equalizeHist(src, dst);

    /// Display results
    namedWindow(source_window, CV_WINDOW_AUTOSIZE);
    namedWindow(equalized_window, CV_WINDOW_AUTOSIZE);

    imshow(source_window, src);
    imshow(equalized_![image description](http://)window, dst);

    /// Wait until user exits the program

    return 0;
edit retag flag offensive reopen merge delete

Closed for the following reason not a real question by berak
close date 2016-10-02 23:01:24.295770



"Give me the solution" or "give solution" (as it was) is unlikely to stimulate many to action. Try taking a look at the function {{cv::equalizeHist}}. It does not do what you seem to think it does.

Der Luftmensch gravatar imageDer Luftmensch ( 2016-10-02 12:27:50 -0500 )edit

the solution is simple. stop copypasting random code snippets, and read a book instead .

berak gravatar imageberak ( 2016-10-02 23:00:32 -0500 )edit

my task is real time object identification......where to start....that plz guide me...provide some material related my work...first time i used this domain so m not finding proper way...help...

N gravatar imageN ( 2016-10-03 00:37:40 -0500 )edit