OpenCV

OpenCV

                              Time Limit: 1000MS

Memory Limit: 65535KB
Submissions: 151Accepted: 35


Description
OpenCV (Open Source Computer Vision) is a library of programming functions for real time computer vision. OpenCV is released under a BSD license, it is free for both academic and commercial use. Example applications of the OpenCV library are Human-Computer Interaction (HCI); Object Identification, Segmentation and Recognition; Face Recognition; Gesture Recognition; Camera and Motion Tracking, Ego Motion, Motion Understanding; Structure From Motion (SFM); Stereo and Multi-Camera Calibration and Depth Computation; Mobile Robotics. Recently ,Phillip has learnt about how to use OpenCV to solve some image problems. Doctor Jiang wants him find the moving items from the given video files. Since using OpenCV can easily deal with such problems, Phillip wants to use his own code to make it out. As we kwon images are saved as a lot of pixels in the computer. The algorithm that Phillip use is below: First, we find the different pixels between current image and the previous one image(in this problem we only care the different pixels) . Second, we record the maximum different number .
Input
The first line are two integers r (row)and c(column) which describe the size of one image. (1 < r, c < 200 ); The second Line is n which is the total number of images (1 < n < 100) Then n*r lines follow, each line contain exactly c numbers which are pixels of the image in the range of 0 to 255.
Output
One line with the maximum differenct number you have found.

Sample Input

4 4
3
255 0 0 255
223 221 220 190
10 11 12 13
0 0 0 0
255 1 1 255
245 221 220 100
11 11 0 13
1 1 1 1
255 0 0 255
245 221 220 100
11 11 0 13
1 1 1 1

Sample Output

10

#include<iostream>
using namespace std;
int main()
{
 int n,m,z,i,j,k,l,a[256],b[100],num,t;
 cin>>n>>m;
 cin>>z;
 for(i=0;i<z;i++)
 {
  num=0;
    for(l=0;l<=256;l++)
     a[l]=0;
   for(j=0;j<m*n;j++)
   {
     cin>>t;
        a[t]++;
   }
   for(k=0;k<=256;k++)
    num+=a[k]!=0;
    b[i]=num;
  }
 int max=b[0];
 for(i=1;i<z;i++)
  if(b[i]>=max)
   max=b[i];
 cout<<max<<endl;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值