⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tiles.cpp

📁 annie is an ANN, ie, Artificial Neural Network library developed in C++. It can be used to implement
💻 CPP
字号:
#include <iostream>#include "annie/annie.h"#include "annie/Image.h"#include "annie/Video.h"#include "ImageCompress.h"using namespace std;namespace annie	{Images makeSubimages(const Image &i, unsigned xSize, unsigned ySize)	{	assert(!(i.getHeight() % ySize));	assert(!(i.getWidth() % xSize));	unsigned py = i.getHeight() / ySize;	unsigned px = i.getWidth() / xSize;	Images outImages(px * py);	for(uint y=0; y<py; y++)		for(uint x=0; x<px; x++)	{			Image *si = i.subImage(xSize, ySize,  x * xSize, y * ySize);			ASSERT(si->getWidth() == xSize);			ASSERT(si->getHeight() == ySize);			if(!si)	throw Exception("cannot create sub :(");	///XX			outImages[y * px + x] = si;		}	return outImages;}TrainingSet *makeSubImageExamples(const Images &images, vector<Vector> &outExamples) {	ASSERT(images.size());		outExamples.resize(images.size());	uint pixels = images[0]->getWidth() * images[0]->getHeight();	TrainingSet *ts = new TrainingSet(pixels, pixels);	for(uint w=0; w<images.size(); w++)	{		outExamples[w] = images[w]->toVector(Image::GRAY_MASK);		ASSERT(outExamples[w].size() == pixels);		ts->addIOpair(outExamples[w], outExamples[w]);	}	return ts;}}	//annie

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -