// snake.cpp : Defines the entry point for the console application.
//
#include<stdafx.h>
#include<cv.h>
#include<highgui.h>
int main(int argc, char* argv[])
{
IplImage* BK;
IplImage* snake;
for(int k=0;k<60000;k+=10)
{
BK = cvLoadImage("C:\\Users\\admin\\Desktop\\1.jpg",1);
snake = cvLoadImage("C:\\Users\\admin\\Desktop\\5.jpg",1);
for(int i=0;i<snake->height;i++)
{
for(int j=0;j<snake->width;j++)
{
if(CV_IMAGE_ELEM(snake,uchar,i,j*3)>=190 && CV_IMAGE_ELEM(snake,uchar,i,j*3+1)>=190 && CV_IMAGE_ELEM(snake,uchar,i,j*3+2)>=190)
continue;
CV_IMAGE_ELEM(BK,uchar,i,(j+k)*3+5)=CV_IMAGE_ELEM(snake,uchar,i,j*3);
CV_IMAGE_ELEM(BK,uchar,i,(j+k)*3+25)=CV_IMAGE_ELEM(snake,uchar,i,j*3+1);
CV_IMAGE_ELEM(BK,uchar,i,(j+k)*3+100)=CV_IMAGE_ELEM(snake,uchar,i,j*3+2);
}
}
cvNamedWindow("Game",1);
cvShowImage("Game",BK);
cvWaitKey(10);
}
cvDestroyWindow("Game");
cvReleaseImage(&BK);
return 0;
}
opencv1.0
最新推荐文章于 2020-09-26 10:55:49 发布