文章标题

来源:互联网 发布:pe系统网络组件下载 编辑:程序博客网 时间:2024/05/16 14:58

My Answers

Question 1, answer:
For include < filename.h > , the compiler starts searching for filename.h from the standard library path and then searches from the local directory, making the system file call faster. For include “filename.h”, the compiler starts searching for filename.h from the user’s working path, and then looks for the system path, making the custom file faster.

Question 2, answer:

#include < iostream >
#include < string >
using namespace std;
#include< stdlib.h >
#include “stdio.h”
void stringZip(const char *pInputStr, long lInputLen, char *pOutputStr)
void stringZip(const char *pInputStr, long lInputLen, string pOutputStr)
{
int count = 1;
int i = 1;
for ( ; i <= lInputLen;)
{
while ((pInputStr + i) == (pInputStr + i - 1))
{
count++;
i++;
}
if (count>1) {
int num = count;
int weishu = 0;
while (num)
{
weishu += 1;
num /=10;
}
pOutputStr += weishu-1;
while (count)
{
int mod = count % 10;
*pOutputStr = mod+’0’;
count = count / 10;
pOutputStr–;
}
pOutputStr += weishu;
pOutputStr++;
char temp= char(count + 48);
}
pOutputStr = (pInputStr + i - 1);
pOutputStr++;
count = 1;
i++;
}
*pOutputStr = ‘\0’;
}
int main()
{
string string_input;
cin >> string_input;
const char* pInputStr = new char[];
pInputStr = string_input.c_str();
char* pOutputStr = new char[];
stringZip(pInputStr,string_input.size(),pOutputStr);
cout << pOutputStr << endl;
cin.get();
return 0;
}
Question 3, answer:
#include< iostream >
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication aa(argc, argv);

int n=1,m;cout<<"please input an number:"<<endl;    while(cin>>m)    {        if(m<1||m>100000)            break;       int s=0,k=0;        int a[100],b[100];       if(n>=m)       {           s=n/m;           n=n%m;       }       while(n!=0)       {           n=n*10;           a[k]=n/m;           n=n%m;           b[k]=n;           for(int i=0;i<k;i++)               if(b[i]==n)               {                   n=0;                   if(i!=0)                   {                   }                   else                   {                   }                   break;               }               k++;       }       cout<<s<<'.';       if(k==2)       {           for(int j=0;j<k-1;j++)            {    cout<<a[j];   }       }       else       {           for(int j=0;j<k;j++)            {    cout<<a[j];   }       }           cout<<"output is finished."           cout<<endl;    }return aa.exec();

}

Question 4, answer:

Question 5, answer:
//a
int main(int argc,char**argv)
{
Mat img=imread(“image.jpg”,0);
Mat gray=Mat(img.rows/2,img.cols/2,CV_8UC1);
resize(img,gray,Size(img.cols/2,img.rows/2),0,0,CV_INTER_LINEAR);
return 0;
}
//b
bool isOverlapped(Rect rectA,Rect rectB)
{
Rect inter=rectA&rectB;
double ratio;
if (inter.height==0)
{
return false;
}
else
{
ratio=(double)(inter.height*inter.width)/(double)(rectA.height*rectA.width+rectB.height*rectB.width-inter.height*inter.width);
if (ratio>=0.50)
{
return true;
}
else
return false;
}

}

Question 6, answer:
I use matlab to solve this problem.
r1=img1(:,:,1);
g1=img1(:,:,2);
b1=img1(:,:,3);

r2=img2(:,:,1);
g2=img2(:,:,2);
b2=img2(:,:,3);

r=double(r1+r2)/2;
g=double(g1+g2)/2;
b=double(b1+b2)/2;

img=[r,g,b];
figure(1),imshow(img);

Question 7, answer:
Mat func(const Mat&img)
{
int y=img.rows;
int x=img.cols;
Mat dst=Mat(x,y,CV_8UC3);
for (int i=0;i < y;i++)
{
for (int j=0;j < x;j++)
{
dst.at(x-j,i)[0]=img.at(i,j)[0];
dst.at(x-j,i)[1]=img.at(i,j)[1];
dst.at(x-j,i)[2]=img.at(i,j)[2];
}
}
return dst;
}

Question 8,answer:
a.My favorite classification for computer vision is ANN,which is short for Artificial Neural Network.With the help of ANN,I make my depth map whose PSNR is higher than the latest SCI article.
b.I do my research in the system of linux.And the framework is Qt, which is attached to opencv2.4.9 .

0 0
原创粉丝点击