• 大小: 5.3MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-11
  • 语言: 其他
  • 标签: opencv  像素值  

资源简介

opencv获取图像像素值,学习opencv如何读图片并显示出来,获取像素值

资源截图

代码片段和文件信息


/***********************************************************************
2.
* OpenCV example
3.
* By Shiqi Yu 2006
4.
***********************************************************************/



#include “cv.h“
#include “highgui.h“
#include “stdio.h“

int main(int argc char* argv[])


    IplImage *img=cvLoadImage(“Lena.jpg“1);
    IplImage *img_temp=cvCreateImage(cvSize(img->widthimg->height) IPL_DEPTH_8U 3);
    CvScalar s;
    for(int i=0;iheight;i++)
{
        for(int j=0;jwidth;j++)
{
s=cvGet2D(imgij); // get the (ij) pixel value
//printf(“B=%f G=%f R=%f “s.val[0]s.val[1]s.val[2]);
//s.val[0]=111;
//s.val[1]=111;
//s.val[2]=111;
cvSet2D(img_tempijs);//set the (ij) pixel value
        }
    }
    cvNamedWindow(“Image“1); 

    cvShowImage(“Image“img_temp);
    cvWaitKey(0); //等待按键 

    cvDestroyWindow( “Image“ );//销毁窗口
    cvReleaseImage( &img ); //释放图像 

    return 0;



 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4303  2008-03-26 14:37  opencv获取图像像素值\ImgReadAndShowTest.dsp

     文件        559  2008-03-26 14:22  opencv获取图像像素值\ImgReadAndShowTest.dsw

     文件   17599488  2011-05-14 21:57  opencv获取图像像素值\ImgReadAndShowTest.ncb

     文件      48640  2011-04-07 21:43  opencv获取图像像素值\ImgReadAndShowTest.opt

     文件       1418  2011-04-07 21:42  opencv获取图像像素值\ImgReadAndShowTest.plg

     文件        901  2011-05-14 21:34  opencv获取图像像素值\ImgReadAndShowTest.sln

    ..A..H.      8192  2011-05-14 21:57  opencv获取图像像素值\ImgReadAndShowTest.suo

     文件       5514  2011-05-14 21:43  opencv获取图像像素值\ImgReadAndShowTest.vcproj

     文件       1427  2011-05-14 21:57  opencv获取图像像素值\ImgReadAndShowTest.vcproj.PC-20100109WRNT.Administrator.user

     文件       1005  2011-04-07 21:42  opencv获取图像像素值\imgTest.cpp

     文件      91814  2008-03-26 14:18  opencv获取图像像素值\Lena.jpg

     文件       5366  2011-05-14 21:43  opencv获取图像像素值\Debug\BuildLog.htm

     文件    4967424  2011-05-14 21:34  opencv获取图像像素值\Debug\ImgReadAndShowTest.bsc

     文件     335872  2011-05-14 21:43  opencv获取图像像素值\Debug\ImgReadAndShowTest.exe

     文件        406  2011-05-14 21:34  opencv获取图像像素值\Debug\ImgReadAndShowTest.exe.embed.manifest

     文件        472  2011-05-14 21:34  opencv获取图像像素值\Debug\ImgReadAndShowTest.exe.embed.manifest.res

     文件        381  2011-05-14 21:43  opencv获取图像像素值\Debug\ImgReadAndShowTest.exe.intermediate.manifest

     文件     190208  2011-05-14 21:43  opencv获取图像像素值\Debug\ImgReadAndShowTest.ilk

     文件    2190336  2011-05-14 21:43  opencv获取图像像素值\Debug\ImgReadAndShowTest.pdb

     文件      68576  2011-05-14 21:34  opencv获取图像像素值\Debug\imgTest.obj

     文件          0  2011-05-14 21:34  opencv获取图像像素值\Debug\imgTest.sbr

     文件         67  2011-05-14 21:43  opencv获取图像像素值\Debug\mt.dep

     文件     279552  2011-04-07 21:42  opencv获取图像像素值\Debug\vc60.idb

     文件      94208  2011-04-07 21:42  opencv获取图像像素值\Debug\vc60.pdb

     文件     568320  2011-05-14 21:34  opencv获取图像像素值\Debug\vc90.idb

     文件     487424  2011-05-14 21:34  opencv获取图像像素值\Debug\vc90.pdb

     目录          0  2012-09-07 23:08  opencv获取图像像素值\Debug

     目录          0  2012-09-07 23:08  opencv获取图像像素值

----------- ---------  ---------- -----  ----

             26951873                    28

............此处省略1个文件信息

评论

共有 条评论