Programowanie w systemie UNIX/OpenCV: Różnice pomiędzy wersjami

Usunięta treść Dodana treść
m →‎c: wersja
Linia 92:
<source lang=c>
/*
http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html
gcc i.c `pkg-config --cflags --libs opencv`
http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html
 
gcc ih.c `pkg-config --cflags --libs opencv`
*/
 
 
OpenCV uses BGR as its default colour order for images,
 
 
 
 
*/
////////////////////////////////////////////////////////////////////////
//
// hello-world.cpp
//
// This is a simple, introductory OpenCV program. The program reads an
// image from a file, inverts it, and displays the result.
//
////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <stdio.h>
Linia 117 ⟶ 131:
 
// load an image
img=cvLoadImage(argv[1],1CV_LOAD_IMAGE_COLOR );
if(!img){
printf("Could not load image file: %s\n",argv[1]);
Linia 136 ⟶ 150:
 
// invert the image
// 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];
 
// show the image
Linia 147 ⟶ 161:
// release the image
cvReleaseImage(&img );
printf("OpenCV version = %s\r\n", CV_VERSION);
return 0;
}
 
</source>