Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
invImage.c
Package: Opencv-source-code.rar [view]
Upload User: banwdc
Upload Date: 2016-06-25
Package Size: 2871k
Code Size: 1k
Category:
OpenCV
Development Platform:
Visual C++
- /* 程序名:invImage.c
- 功能:读入图像文件,做图像反转,然后显示图像在屏幕上
- */
- #include <stdlib.h>
- #include <stdio.h>
- #include <math.h>
- #include <cv.h>
- #include <highgui.h>
- int main(int argc, char *argv[])
- {
- IplImage* img = 0;
- int height,width,step,channels;
- uchar *data;
- int i,j,k;
- if(argc<2)
- {
- printf("Usage: main <image-file-name>n7");
- exit(0);
- }
- // 载入图像
- img=cvLoadImage(argv[1],-1);
- if(!img)
- {
- printf("Could not load image file: %sn",argv[1]);
- exit(0);
- }
- // 获取图像信息
- height = img->height;
- width = img->width;
- step = img->widthStep;
- channels = img->nChannels;
- data = (uchar *)img->imageData;
- printf("Processing a %dx%d image with %d channelsn",height,width,channels);
- // 创建窗口
- cvNamedWindow("mainWin", CV_WINDOW_AUTOSIZE);
- cvMoveWindow("mainWin", 100, 100);
- // 反转图像
- for(i=0;i<height;i++) for(j=0;j<width;j++) for(k=0;k<channels;k++)
- data[i*step+j*channels+k]=255-data[i*step+j*channels+k];
- // 显示图像
- cvShowImage("mainWin", img );
- cvWaitKey(0);
- cvReleaseImage(&img );
- return 0;
- }