利用OPENCV实现透视变换

#include <iostream>
#include <string>
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "HougnRoundCheck.h"

using namespace cv;
using namespace std;

// 直方图均衡化
Mat equalize_img(Mat& src_img)
{
   
    Mat result;
    equalizeHist(src_img, result);
    return result;
}

Mat show_img_histogram(Mat& src_img)
{
   
    //create 256 subinterval
    //the number of possibles values
    int numbins = 256;

    //set the range for BGR(0-256)
    float range[] = {
    0, 256 };
    const float* histRange = {
    range };

    Mat gray_hist;
    calcHist(&src_img, 1, 0, Mat(), gray_hist, 1, &numbins, &histRange);

    //draw histogram
    //draw lines for each channels
    int width = 512;
    int height = 300;

    // Create image with gray base
    Mat histImage(height, width, CV_8UC3, Scalar(20, 20, 20));

    // Normalize the histograms to height of image
    normalize(gray_hist, gray_hist, 0, height, NORM_MINMAX);

    int binStep = cvRound((float)width / (float)numbins);
    for (int i = 1; i < numbins; i++) {
   
        line(
            histImage,
            Point(binStep * (i - 1), height - cvRound(gray_hist.at<float>(i - 1))),
            Point(binStep * (i), height - cvRound(gray_hist.at<float>(i))),
            Scalar(255, 0, 0)
        );
    }
    return histImage;
}

Mat display(Mat img)
{
   
    // Load image to process

    Mat srcGray;
    cv::cvtColor
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值