annie is an ANN, ie, Artificial Neural Network library developed in C++. It can be used to implement

源代码在线查看: tiles.cpp

软件大小: 482 K
上传用户: danlong
关键词: Artificial developed implement Network
下载地址: 免注册下载 普通下载 VIP

相关代码

				#include 								#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						for(uint x=0; 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 &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						outExamples[w] = images[w]->toVector(Image::GRAY_MASK);						ASSERT(outExamples[w].size() == pixels);						ts->addIOpair(outExamples[w], outExamples[w]);					}									return ts;				}								}	//annie							

相关资源