zoukankan      html  css  js  c++  java
  • opencv的图片的灰度处理‘

    #include "stdafx.h" //实现将彩色图片转换成灰度图

    int _tmain(int argc, _TCHAR* argv[])
    {
    IplImage *image; //初始化保存原始图像
    IplImage *result; //保存灰度图

    image = cvLoadImage("图片3.jpg",-1);

    int channel =-1;
    int depth =image->depth;
    CvSize sz;
    sz.width =image->width;
    sz.height =image->height;

    result = cvCreateImage(sz,depth,channel);
    cvCvtColor(image,result,CV_BGR2GRAY);
    cvNamedWindow("original",1);
    cvShowImage("original",image);
    cvNamedWindow("gray",1);
    cvShowImage("gray",result);
    cvSaveImage("路面5.jpg",result);


    cvWaitKey(0);
    cvReleaseImage(&image);
    cvReleaseImage(&result);
    cvDestroyWindow("original");
    cvDestroyWindow("gray");
    return 0;
    }

  • 相关阅读:
    设计模式
    工厂方法模式
    简单工厂模式
    tornado自定义Form组件
    tornado
    Tornado框架的知识系列
    Linux基本命令
    day2
    day1
    使用cp复制文件夹却不能打开
  • 原文地址:https://www.cnblogs.com/Peit/p/6049626.html
Copyright © 2011-2022 走看看