SimpleIP (Simple Image-Processing) 是一个不想用matlab写图像处理作业的学生写的跨平台图像处理框架。
OpenIP::Board* board = new OpenIP::Board("MyWindow",640,480,new OpenIP::ColorRGB(255,255,255));
board->setEventHandling();
1. 读取png图片为RGB矩阵std::vector<std::vector<ColorRGB*>>
PNGLoader *pngloader = new PNGLoader();
std::vector<std::vector<ColorRGB *>> pixelsMap = pngloader->loadPNG("yz.png");
PixelMap* pixelMap = new PixelMap(0, 0, width, height, new ColorRGB(255, 255, 255));
pngLoader->loadPNGToPixelMap("yz.png",pixelMap);
PixelMap* pixelmap = new PixelMap(0, 0, this->width / 4, this->height / 2, new ColorRGB(255, 255, 255));
for (int i = 0; i < this->width / 4; i++) {
std::vector<Pixel *> pp;
for (int j = 0; j < this->height / 2; j++) {
pp.push_back(new Pixel(i, j, pixelsMap[j][i]));
}
pixels.push_back(pp);
}
pixelmap->setPixelMap(pixels);
4. PixelMap像素矩阵标准化【根据窗口大小】
pixelmap->normalize(width, height);
Fliter* fliter = new Fliter(pixelMap);
pixelMap = fliter->median();
Fliter* fliter = new Fliter(pixelMap);
pixelMap = fliter->max();
Fliter* fliter = new Fliter(pixelMap);
pixelMap = fliter->min();
Fliter* fliter = new Fliter(pixelMap);
pixelMap = fliter->arithmetic_mean();
Fliter* fliter = new Fliter(pixelMap);
pixelMap = fliter->geometric_mean();
Fliter* fliter = new Fliter(pixelMap);
pixelMap = fliter->harmonics();
Fliter* fliter = new Fliter(pixelMap);
pixelMap = fliter->inverse_harmonic();
Font* font = new Font("default.otf", FONT_MODE::TRANSPARENT,new ColorRGB(255,255,255), new ColorRGB(0,255,0), 500, 500,100, 200);
font->draw("this is my font");
font->normalize(width,height);