当前位置: 首页>>代码示例>>C++>>正文


C++ Histogram1D类代码示例

本文整理汇总了C++中Histogram1D的典型用法代码示例。如果您正苦于以下问题:C++ Histogram1D类的具体用法?C++ Histogram1D怎么用?C++ Histogram1D使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Histogram1D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: on_pushButton_clicked

//------------------ shows histogram values on the graphic----------------------------------
void MainWindow::on_pushButton_clicked()
{
    Histogram1D graph;

    cv::namedWindow("histogram graph");
    cv::imshow("histogram graph", graph.getHistogramImage(image));
}
开发者ID:ekimcak,项目名称:Ekim-Vision-test-code,代码行数:8,代码来源:mainwindow.cpp

示例2:

//----------------- shows image's histogram on terminal-----------------------------------
void MainWindow::on_pushButton_2_clicked()
{
    Histogram1D terminal;

    cv::MatND histo=terminal.getHistogram(image);
// shows values of histgoram on terminal
   for (int i=0; i<256; i++)
        std::cout<<"value"<<i<<"="<<histo.at<float>(i)<<std::endl;
}
开发者ID:ekimcak,项目名称:Ekim-Vision-test-code,代码行数:10,代码来源:mainwindow.cpp

示例3: case2histogram

void case2histogram() {
    cv::Mat image=cv::imread( inputImagePath4case1histogram,cv::IMREAD_GRAYSCALE );//open in b&w
    alert_win( image );

    Histogram1D h;
    cv::Mat re= h.getHistogramImage(image);
    alert_win( re );

}
开发者ID:Letractively,项目名称:cplusplus4java,代码行数:9,代码来源:chp04.cpp

示例4: case1histogram

void case1histogram() {
    cv::Mat image=cv::imread( inputImagePath4case1histogram,cv::IMREAD_GRAYSCALE );//open in b&w
    Histogram1D h;
    cv::MatND histo=h.getHistogram(image);

    for(int i=0; i<256; i++) {
        cout<<"Value "<< i << " = " << histo.at<float>( i )<<endl;
    }
}
开发者ID:Letractively,项目名称:cplusplus4java,代码行数:9,代码来源:chp04.cpp

示例5: case4histogram

void case4histogram() {
    cv::Mat image=cv::imread( inputImagePath4case1histogram,cv::IMREAD_GRAYSCALE );
    alert_win( image );

    Histogram1D h;
    cv::Mat eq=h.equalize( image );
    alert_win( eq );

}
开发者ID:Letractively,项目名称:cplusplus4java,代码行数:9,代码来源:chp04.cpp

示例6: size

void Histogram1D::multiply_with_ratio_exponented(const Histogram1D & nominator, const Histogram1D & denominator, double exponent){
   check_compatibility(nominator);
   check_compatibility(denominator);
   const double * n_data = nominator.get_data();
   const double * d_data = denominator.get_data();
   double * data = get_data();
   const size_t n = size();
   for(size_t i=0; i<n; i++){
      if(d_data[i]>0.0)
         data[i] *= pow(n_data[i] / d_data[i], exponent);
   }
}
开发者ID:blinkseb,项目名称:theta,代码行数:12,代码来源:histogram.cpp

示例7: on_btnEqualizer_clicked

void ImagePro::on_btnEqualizer_clicked()
{
    cv::Mat tepImg;
    std::vector<cv::Mat> tmp;
    cv::split(_img,tmp);
    Histogram1D HH;
    for (int i=0;i<3;i++){
        tmp[i]=HH.equalize(tmp[i]);
    }
    cv::merge(tmp,tepImg);
    cv::namedWindow("histogram equalize");
    cv::imshow("histogram equalize",tepImg);
}
开发者ID:zpeng-projects,项目名称:myopencv,代码行数:13,代码来源:imagepro.cpp

示例8: on_btnHistoStretch_clicked

void ImagePro::on_btnHistoStretch_clicked()
{
    cv::Mat tepImg;
    std::vector<cv::Mat> tmp;
    cv::split(_img,tmp);
    Histogram1D HH;
    for (int i=0;i<3;i++){
        tmp[i]=HH.stretch(tmp[i]);
    }
    cv::merge(tmp,tepImg);
    cv::namedWindow("stretch histogram");
    cv::imshow("stretch histogram",tepImg);
}
开发者ID:zpeng-projects,项目名称:myopencv,代码行数:13,代码来源:imagepro.cpp

示例9: histos_equal

bool histos_equal(const Histogram1D & h1, const Histogram1D & h2){
    if(h1.get_nbins()!=h2.get_nbins()) return false;
    if(h1.get_xmin()!=h2.get_xmin()) return false;
    if(h1.get_xmax()!=h2.get_xmax()) return false;
    const size_t n = h1.get_nbins();
    for(size_t i=0; i<n; i++){
        if(h1.get(i)!=h2.get(i)) return false;
    }
    return true;
}
开发者ID:blinkseb,项目名称:theta,代码行数:10,代码来源:utils.cpp

示例10: compatible

void Histogram1D::fail_check_compatibility(const Histogram1D & h) const {
    std::stringstream s;
    s <<  "Histogram1D::check_compatibility: Histograms are not compatible (nbins, xmin, xmax) are: "
            " (" << get_nbins() << ", " << xmin << ", " << xmax << ") and "
            " (" << h.get_nbins() << ", " << h.xmin << ", " << h.xmax << ")";
    throw invalid_argument(s.str());
}
开发者ID:blinkseb,项目名称:theta,代码行数:7,代码来源:histogram.cpp

示例11: simplifyImage

cv::Mat ImageProcessor::simplifyImage(cv::Mat &origImage, int blurWindow, int stretchMinVal, int equalize) {
	cv::Mat improvImage;
	Histogram1D h;

	if(origImage.type() != 0) cv::cvtColor( origImage, improvImage, CV_BGR2GRAY );
	else origImage.copyTo(improvImage);

	if (equalize) {
		cv::equalizeHist(improvImage, improvImage);
	} else {
		improvImage = h.stretch(improvImage, stretchMinVal);
	}

	if(blurWindow > 0)
		cv::medianBlur(improvImage, improvImage, blurWindow);

	return improvImage;
}
开发者ID:tmramalho,项目名称:bigCellBrotherGUI,代码行数:18,代码来源:ImageProcessor.cpp

示例12: dim

//-------------------- tranforms the image to negative---------------------------------------
//-------------------- shows it's histogram values on graphic--------------------------------
void MainWindow::on_pushButton_4_clicked()
{
    Histogram1D negative;
    //build look up
    int dim(256);
    cv::Mat lut(1, &dim, CV_8U); // lut is a matrix which is in 1D
    for(int i=0; i<256; i++)
    {
        lut.at<uchar>(i)=255-i; //takes all the values and reverses it
    }
    cv::Mat negativeResult;
    negativeResult=negative.applyLookUp(image,lut);
    cv::namedWindow("negative");
    cv::imshow("negative",negativeResult);

    //negative image histogram
    cv::imshow("negative histogram",negative.getHistogramImage(negativeResult));

}
开发者ID:ekimcak,项目名称:Ekim-Vision-test-code,代码行数:21,代码来源:mainwindow.cpp

示例13: main

int main()
{
  Mat src;
  src = imread("box.png");
 if( !src.data )
    { 
  cout<<"error";
  }

  namedWindow("image", CV_WINDOW_AUTOSIZE );
  imshow("image", src );
  waitKey(0);

  // The histogram object
Histogram1D h;
namedWindow("Histogram");
imshow("Histogram",h.getHistogramImage(src));
waitKey(0);

  return 1;

}
开发者ID:07hk-mani,项目名称:opencv3,代码行数:22,代码来源:Source.cpp

示例14: tr

void ImagePro::on_btnLoadImg_clicked()
{
    QString fileName = QFileDialog::getOpenFileName(this,
                                                    tr("Open Image"), ".",
                                                    tr("Image Files (*.png *.jpg *.jpeg *.bmp)"));

    _img= cv::imread(fileName.toUtf8().constData());
    cv::namedWindow("Original Image");
    cv::imshow("Original Image", _img);

    Histogram1D HH;
    cv::Mat histIm = HH.getHistgramImage(_img);
    cv::namedWindow("Histogram");
    cv::imshow("Histogram", histIm);

    cv::Mat thresholded;
    cv::Mat imgG;
    cv::cvtColor(_img,imgG,CV_BGR2GRAY);
    cv::threshold(imgG,thresholded,60,255,cv::THRESH_BINARY);
    cv::namedWindow("binary");
    cv::imshow("binary", thresholded);

}
开发者ID:zpeng-projects,项目名称:myopencv,代码行数:23,代码来源:imagepro.cpp

示例15: main

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    Mat image = imread("D:\\workspace\\pictures\\771413900_m.jpg",0);
    Mat thresholded, result;

    Histogram1D h;

    MatND histo = h.getHistogram(image);

    for (int i=0;i<256;i++)
        cout << "Value" << i << "=" << histo.at<float>(i) << endl;

    imshow("Orginal", image);

    imshow("Histogram",h.getHistogramImage(image));

    //threshold(image, thresholded,128,255,THRESH_BINARY);

    //imshow("Threshold",thresholded);

    equalizeHist(image,result);

    //Mat stretched = h.stretch(image,100);

    //imshow("Stretched",stretched);

    imshow("Equalize",result);

    imshow("After Equalize Histogram",h.getHistogramImage(result));


    waitKey(50000);

    return a.exec();
}
开发者ID:vmebus,项目名称:workspace,代码行数:37,代码来源:main.cpp


注:本文中的Histogram1D类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。