Ejemplo n.º 1
0
int main()
{
	int n, m;
	while(scanf("%d%d", &n, &m) != EOF) {
		int r = (1 << n), c = (1 << m);
		for(int i = 0; i < r; i++) {
			int ans = togray(i);
			for(int j = 0; j < c; j++) printf("%d%c", (ans << m) | togray(j), j == c-1 ? '\n' : ' ');
		}
	}
	return 0;
}
Ejemplo n.º 2
0
void CommandHandlerImpl::calculate()
{
	if (input == nullptr)
		return;
	//hide();
	//cvWaitKey(1000);
	togray();
	binaryzation();
	erode();
	dilate();
	count();

	printf("Counted by area size:\n");
	printf("Bottles:%d,Full bottles:%d\n", whites, fulls1);
	printf("From left to right, not filled bottles are:(1~%d)\n",whites);
	for (int i = 0; i < maxbottle; i++)
		(emptybottles1[i] == 1) ? printf("%d ", i + 1) : 1;
	printf("\n");
	printf("Counted by area minimum height:\n");
	printf("Bottles:%d,Full bottles:%d\n", whites, fulls2);
	printf("From left to right, not filled bottles are:(1~%d)\n", whites);
	for (int i = 0; i < maxbottle; i++)
		(emptybottles2[i] == 1) ? printf("%d ", i + 1) : 1;
	printf("\n");
}
Ejemplo n.º 3
0
void CDimageView::On24bit2gray()
{
	// TODO: 在此添加命令处理程序代码
	CDimageDoc* pDoc= GetDocument();

	if(!pDoc->m_Img->IsValidate()) //Img为NULL则无法操作
		return;

	if(pDoc->m_OImg->IsValidate()) //每回先更新OImg内容,有改变即全删重新分配地址,比较保守
	{
		delete []pDoc->m_OImg;
		pDoc->m_OImg=NULL;
	}
	pDoc->m_OImg= new CImg(*pDoc->m_Img);

	delete []pDoc->m_Img;
	pDoc->m_Img = togray(pDoc->m_OImg);
	Invalidate(1);
}