Esempio n. 1
0
std::vector<std::vector<int> > getFeatures(std::vector<cv::Mat> imLBP){
	int m = imLBP[0].rows / 2;
	int n = imLBP[0].cols / 2;

	std::vector<int> bins = initHistogram();
	std::vector<std::vector<int> > features;

	for (unsigned int k = 0; k < imLBP.size(); k++){
		cv::Mat quad1(m, n, CV_8U);
		cv::Mat quad2(m, n, CV_8U);
		cv::Mat quad3(m, n, CV_8U);
		cv::Mat quad4(m, n, CV_8U);

		for (int i = 0; i < m; i++){
			for (int j = 0; j < n; j++){
				quad1.at<uchar>(i, j) = imLBP[k].at<uchar>(i, j);
				quad2.at<uchar>(i, j) = imLBP[k].at<uchar>(i, j+n);
				quad3.at<uchar>(i, j) = imLBP[k].at<uchar>(i+m, j);
				quad4.at<uchar>(i, j) = imLBP[k].at<uchar>(i+m, j+n);
			}
		}

		std::vector<int> histLBP_1 = histLBP(quad1, bins);
		std::vector<int> histLBP_2 = histLBP(quad2, bins);
		std::vector<int> histLBP_3 = histLBP(quad3, bins);
		std::vector<int> histLBP_4 = histLBP(quad3, bins);

		std::vector<int> feature;
		feature.reserve(histLBP_1.size() + histLBP_2.size() + histLBP_3.size() + histLBP_4.size());
		feature.insert(feature.end(), histLBP_1.begin(), histLBP_1.end());
		feature.insert(feature.end(), histLBP_2.begin(), histLBP_2.end());
		feature.insert(feature.end(), histLBP_3.begin(), histLBP_3.end());
		feature.insert(feature.end(), histLBP_4.begin(), histLBP_4.end());

		features.push_back(feature);
	}

	return features;
}
Esempio n. 2
0
// -----------------------------------------------------------------
// Name : initGraphics
// -----------------------------------------------------------------
void Map::initGraphics(DisplayEngine * pDisplay)
{
    FREE(m_pTileGeometry);
    QuadData tilequad(0.0f, 1.0f, 0.0f, 1.0f, "maptile init texture", pDisplay);
    m_pTileGeometry = new GeometryQuads(&tilequad, VB_Static);
    assert(m_pTiles != NULL);
    for (u16 x = 0; x < m_iWidth; x++)
    {
        for (u16 y = 0; y < m_iHeight; y++)
        {
            m_pTiles[x][y]->initGraphics(m_pTileGeometry, pDisplay);
            setTileMask(x, y);
            Town * pTown = (Town*) m_pTiles[x][y]->getFirstMapObject(GOTYPE_TOWN);
            if (pTown != NULL)
                pTown->initGraphics(pDisplay);
            Temple * pTemple = (Temple*) m_pTiles[x][y]->getFirstMapObject(GOTYPE_TEMPLE);
            if (pTemple != NULL)
                pTemple->initGraphics(pDisplay);
        }
    }
    FREE(m_pEmptyMapGeometry);
    QuadData mapquad(0.0f, (float) m_iWidth, 0.0f, (float) m_iHeight, "map", pDisplay);
    m_pEmptyMapGeometry = new GeometryQuads(&mapquad, VB_Static);
    FREE(m_pTombGeometry);
    QuadData quad(0.0f, 0.4f, 0.0f, 0.4f, "skull", pDisplay);
    m_pTombGeometry = new GeometryQuads(&quad, VB_Static);
    FREE(m_pFoeBannerGeometry);
    QuadData quad2(0.0f, 0.3f, 0.0f, 0.3f, "attack_icon", pDisplay);
    m_pFoeBannerGeometry = new GeometryQuads(&quad2, VB_Static);
    FREE(m_pCountUnitsBgGeometry1L);
    QuadData quad3(0.0f, 0.4f, 0.0f, 0.3f, "bg-shadowed", pDisplay);
    m_pCountUnitsBgGeometry1L = new GeometryQuads(&quad3, VB_Static);
    FREE(m_pCountUnitsBgGeometry2L);
    QuadData quad4(0.0f, 0.4f, 0.0f, 0.6f, "bg-shadowed", pDisplay);
    m_pCountUnitsBgGeometry2L = new GeometryQuads(&quad4, VB_Static);
}
Esempio n. 3
0
Region& Region::Exclude(const Rect &excludeRect)
{
	BeginOperation();
	int index = 0;
	int rectsToCheck = fNumRects;
	while (index < rectsToCheck) {
		Rect &clipRect = fRects[index];

		if (!excludeRect.Intersects(clipRect)) {
			index++;
			continue;
		}

		// This clip rect intersects the excluded rect, and could be divided into
		// as many as eight pieces.  Test for each case.  Note that none of these
		// rectangles overlap!!!!
		Rect quad1(clipRect.left, clipRect.top, excludeRect.left - 1, excludeRect.top - 1);
		if (SPLIT_TEST(clipRect, quad1)) {
			quad1.Intersect(clipRect);
			AddRect(quad1);
		}

		Rect quad2(excludeRect.left, clipRect.top, excludeRect.right, excludeRect.top - 1);
		if (SPLIT_TEST(clipRect, quad2)) {
			quad2.Intersect(clipRect);
			AddRect(quad2);
		}

		Rect quad3(excludeRect.right + 1, clipRect.top, clipRect.right, excludeRect.top - 1);
		if (SPLIT_TEST(clipRect, quad3)) {
			quad3.Intersect(clipRect);
			AddRect(quad3);
		}

		Rect quad4(clipRect.left, excludeRect.top, excludeRect.left - 1, excludeRect.bottom);
		if (SPLIT_TEST(clipRect, quad4)) {
			quad4.Intersect(clipRect);
			AddRect(quad4);
		}

		Rect quad5(excludeRect.right + 1, excludeRect.top, clipRect.right, excludeRect.bottom);
		if (SPLIT_TEST(clipRect, quad5)) {
			quad5.Intersect(clipRect);
			AddRect(quad5);
		}

		Rect quad6(clipRect.left, excludeRect.bottom + 1, excludeRect.left - 1, clipRect.bottom);
		if (SPLIT_TEST(clipRect, quad6)) {
			quad6.Intersect(clipRect);
			AddRect(quad6);
		}

		Rect quad7(excludeRect.left, excludeRect.bottom + 1, excludeRect.right, clipRect.bottom);
		if (SPLIT_TEST(clipRect, quad7)) {
			quad7.Intersect(clipRect);
			AddRect(quad7);
		}

		Rect quad8(excludeRect.right + 1, excludeRect.bottom + 1, clipRect.right, clipRect.bottom);
		if (SPLIT_TEST(clipRect, quad8)) {
			quad8.Intersect(clipRect);
			AddRect(quad8);	
		}

		// This rect has been split, remove it.  Note we don't
		// change the index
		RemoveRect(index);		
		rectsToCheck--;
	}
	EndOperation();
	return *this;
}
Esempio n. 4
0
//----------------------------------------------------------------------------------------------------
DIVAGame::DIVAGame(NoteMap _noteMap)
	:
	m_isStart(false),
	m_currentTime(0.f),
	m_totalTime(0.f),
	m_noteTime(0.f),
	m_noteTimeForward(0.f),
	m_singleTime(0.f),
	m_distanceTime(0.f),

	m_noteMap(_noteMap),
	m_notes(),
	m_emitter(),

	circleTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal/Normal-Circle.png"),
	crossTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal/Normal-Cross.png"),
	squareTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal/Normal-Square.png"),
	triangleTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal/Normal-Triangle.png"),
	rightTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal-Array/Normal-Array Right.png"),
	leftTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal-Array/Normal-Array Left.png"),
	downTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal-Array/Normal-Array Down.png"),
	upTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal-Array/Normal-Array Up.png"),
	stripBlueTex(L"Texture/Project Diva Freedom/自由模式/NOTE/Strip/Strip/Strip-Blue.png"),
	stripGreenTex(L"Texture/Project Diva Freedom/自由模式/NOTE/Strip/Strip/Strip-Green.png"),
	stripPinkTex(L"Texture/Project Diva Freedom/自由模式/NOTE/Strip/Strip/Strip-Pink.png"),
	stripRedTex(L"Texture/Project Diva Freedom/自由模式/NOTE/Strip/Strip/Strip-Red.png")
{
	EETexture hitTex[34] = {
		L"Texture/Project Diva Freedom/自由模式/HIT/effect30.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect29.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect28.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect27.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect26.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect25.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect24.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect23.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect22.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect21.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect20.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect19.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect18.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect17.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect16.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect15.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect14.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect13.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect12.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect11.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect10.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect9.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect8.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect7.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect6.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect5.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect4.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect3.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/effect2.png",
		L"Texture/Project Diva Freedom/自由模式/HIT/hit-1(线性减淡).png",
		L"Texture/Project Diva Freedom/自由模式/HIT/hit-2(线性减淡).png",
		L"Texture/Project Diva Freedom/自由模式/HIT/hit-3(线性减淡).png",
		L"Texture/Project Diva Freedom/自由模式/HIT/hit-4(线性减淡).png",
		L"Texture/Project Diva Freedom/自由模式/HIT/sad-01.png",
	};
	// 0
	EESlide hitSlide(Rect_Float(-64, -64, 64, 64), hitTex, 29, 0.0f, false);
	hitSlide.SetInterval(0.05f / 29.f);

	EEAnimationFrame frame0;
	frame0.SetObject(hitSlide);
	frame0.startTime = 0.0f;
	frame0.duration = 0.05f;

	// 1
	EEQuad2D quad1(Rect_Float(-40, -40, 40, 40), hitTex[29]);
	//quad1.SetScale(3.0f);
	EEAnimationFrame frame1;
	frame1.SetObject(quad1);
	frame1.startTime = 0.05f;
	frame1.duration = 0.35f;
	float alpha11 = 0.0f;
	float scale11 = 2.0f;
	frame1.actions.push_back(boost::bind(EEFade, _1, 0.35f, alpha11, _2));
	frame1.actions.push_back(boost::bind(EEScale, _1, 0.35f, scale11, _2));

	// 2
	EEQuad2D quad2(Rect_Float(-40, -40, 40, 40), hitTex[30]);
	EEAnimationFrame frame2;
	frame2.SetObject(quad2);
	frame2.startTime = 0.05f;
	frame2.duration = 0.05f;
	float rotation2 = EE_2PI;
	frame2.actions.push_back(boost::bind(EERotateYX, _1, 0.05f, rotation2, _2, false));

	// 3
	EEQuad2D quad3(Rect_Float(-50, -50, 50, 50), hitTex[31]);
	float alpha30 = 0.8f;
	float alpha31 = 0.0f;
	quad3.SetAlpha(alpha30);
	EEAnimationFrame frame3;
	frame3.SetObject(quad3);
	frame3.startTime = 0.1f;
	frame3.duration = 0.05f;
	frame3.actions.push_back(boost::bind(EEFade, _1, 0.05f, alpha31, _2));

	// 4
	EEQuad2D quad4(Rect_Float(-50, -50, 50, 50), hitTex[32]);
	EEAnimationFrame frame4;
	frame4.SetObject(quad4);
	frame4.startTime = 0.5f;
	frame4.duration = 0.07f;
	float alpha41 = 0.0f;
	float scale41 = 4.0f;
	frame4.actions.push_back(boost::bind(EEFade, _1, 0.07f, alpha41, _2));
	frame4.actions.push_back(boost::bind(EEScale, _1, 0.07f, scale41, _2));

	EEAnimation animation;
	animation.AddFrame(frame0);
	animation.AddFrame(frame2);
	animation.AddFrame(frame3);
	animation.AddFrame(frame1);
	animation.AddFrame(frame4);
	//animation.SetIsLoop(true);

	m_emitter.SetAnimation(&animation);
}