西南石油大学第三届信息安全大赛之QR码

19 篇文章 0 订阅

这几天在玩这个,发一下关于QR码的程序吧。

题目如下:


题目标题说明是QR码,看来是需要用程序来把上面的数字来生成QR码。代码如下:(基于OPENCV来实现的)

//由于图片太小,这里把图片放大了十倍

 
#include <stdio.h>
#include <stdlib.h>
#include "cv.h"
#include "cvaux.h"
#include "cxcore.h"
#include "highgui.h"

int main()
{
	int t[]={1,1,1,1,1,1,1,0,1,0,0,1,1,0,1,1,1,0,1,1,1,1,1,1,1,
1,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,
1,0,1,1,1,0,1,0,0,0,1,0,1,0,0,1,1,0,1,0,1,1,1,0,1,
1,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,
1,0,1,1,1,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,1,0,1,
1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,
1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,
0,0,0,0,0,0,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,0,0,0,0,
1,1,0,1,1,0,1,0,0,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,1,0,1,1,1,0,1,1,
0,1,1,1,1,0,1,0,0,0,1,1,0,1,0,1,0,1,1,1,1,0,1,0,1,
0,1,1,1,1,1,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,0,
1,0,0,0,0,1,1,0,0,1,0,1,1,1,0,0,1,0,1,0,0,1,0,1,1,
1,0,1,1,0,1,0,0,1,1,0,0,0,1,1,1,1,1,1,1,1,0,0,1,0,
1,1,1,0,1,1,1,1,0,0,0,1,1,1,0,1,0,1,0,0,1,0,0,1,1,
1,0,1,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,0,1,1,1,
1,0,1,0,1,0,1,0,1,1,0,0,0,0,1,0,1,1,1,1,1,0,1,1,1,
0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,1,0,0,0,1,0,1,0,1,
1,1,1,1,1,1,1,0,0,0,1,1,0,0,0,0,1,0,1,0,1,1,1,0,1,
1,0,0,0,0,0,1,0,0,1,0,0,1,0,1,1,1,0,0,0,1,1,0,1,1,
1,0,1,1,1,0,1,0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,1,
1,0,1,1,1,0,1,0,1,0,1,0,0,0,1,0,1,1,1,1,1,1,1,1,1,
1,0,1,1,1,0,1,0,0,0,1,0,1,0,1,1,0,1,0,1,1,1,0,1,1,
1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,1,0,1,1,1,0,1,1,1,1,
1,1,1,1,1,1,1,0,1,0,0,0,0,1,1,1,1,0,0,0,1,1,0,0,1};
	cvNamedWindow("a");
	IplImage* img=cvCreateImage(cvSize(250,250),IPL_DEPTH_8U,1);
	int m,n;
	for(int i=0;i<250;++i)       
	{
		for(int j=0;j<250;++j)
		{
			m=i/10;
			n=j/10;
			if(t[n*25+m]==0)
				((uchar*)(img->imageData+img->widthStep*j))[i]=(char)(255);
			else
				((uchar*)(img->imageData+img->widthStep*j))[i]=(char)(0);
		}
	}
	cvShowImage("a",img);
	cvWaitKey(0);
	//system("pause");
	return 0;
}
效果如下:


百度上传扫一下就出来了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值