}
{obj_set[m1].x=3; obj_set[m1].y=3; m1++;}
if (m1 != 4) {AfxMessageBox(\请选择四个小方块\return;} SeekImage();
void CImageRetrievalDlg::SeekImage() {
CString imagefilepath = strfile;
CalculateColor(imagefilepath);
CalculateColorPair(obj_set[0].x, obj_set[0].y); CalculateColorPair(obj_set[1].x, obj_set[1].y); CalculateColorPair(obj_set[2].x, obj_set[2].y); CalculateColorPair(obj_set[3].x, obj_set[3].y); SortColorPair(); struct pairs temps[32];
for(int count1=0; count1<32; count1++)
{ }
temps[count1].x1 = pair[count1].x1; temps[count1].y1 = pair[count1].y1; temps[count1].o_dis1 = pair[count1].o_dis1;
CString temp_1[1000];
for(int count2=0; count2 temp_1[count2] = *temp[count2]; int match=0; double ave=0; int scan=0,picnum=1002,piccount=0,pic1=0; CString picn; for(int s=0;s ave+=pair[s].o_dis1; ave=ave/pair_count; ave=ave*0.02; CWnd* pWnd = GetDlgItem(IDC_STATIC_NUM);// 获取绘制直方图文本 框的标签 CDC* pDC = pWnd->GetDC();// 获取设备上下文 for(int pic=0; pic CalculateColor(temp_1[pic]); //显示正在检索的第N幅图 ShowPic(temp_1[pic],IDC_VIEW14); picn.Format(\ pDC->TextOut(0,0,picn); int pairflag[32]; for(int t=0; t<32; t++) { } for(int i=0; i<4; i++) pairflag[t]=-1; for(int j=0;j<4;j++) { CalculateColorPair(i,j); for( scan=0; scan<8; scan++) { } for(int comp=0; comp if(fabs(temps[count].o_dis1-pair[comp].o_dis1) pairflag[count]!=0) } { } if(match>=pair_count*0.60) piccount++; pair[re].x1=-1; for(int re=0;re } { } pairflag[count]=0; match++; break; if(match>=pair_count*0.60 && picnum<=1013) } { } ShowPic(temp_1[pic],picnum); picnum++; //显示相似匹配数 CWnd* pWnd1 = GetDlgItem(IDC_STATIC_TOTAL); CDC* pDC1 = pWnd1->GetDC(); picn.Format(\ pDC1->TextOut(0,0,picn); } 矩阵旋转算法的实现 作者: 来源:http://blog.csdn.net/Iwinstone 发表时间:2006-12-19 浏览次数: 1171 字号:大 中 小 题目描述:将一个N*N方阵旋转四次,再回到原来的样子,过程如下(以N=3为例): 1 4 7 2 5 8 3 6 9 7 8 9 9 6 3 3 2 1 1 4 7 4 5 6 8 5 2 6 5 4 2 5 8 1 2 3 7 4 1 9 8 7 3 6 9 现要求编程模拟该过程。 算法分析: 对于该矩阵旋转,我们可采用类似堆栈的操作来实现,方法是定义两个数组,从数组1中按列取出(弹栈)数显示出来,并按行放 入数组2中(压栈),然后从数组2中按原规则取出数据显示并放入数组1中,如此每进行一次操作我们所取的数组中的数据就会顺时 针旋转90度,循环下去就可显示其旋转过程。 该过程如下表所示: 数组1 1 2 3 4 5 6 数组2 7 4 1 8 5 2 9 6 3 7 8 9 该算法源代码如下(C语言):