/SimpleIP

image processing

Primary LanguageC++

SimpleIP (Simple Image-Processing) 是一个不想用matlab写图像处理作业的学生写的跨平台图像处理框架。

屏幕快照 2017-10-17 下午8.31.29

尚在测试中的即将加入的增强学习部分的 demo

屏幕快照 2017-10-17 下午8.31.29 屏幕快照 2017-10-17 下午8.31.29

尚在调试中的边缘识别

屏幕快照 2017-10-17 下午8.31.29

窗口

1. 新建窗口

OpenIP::Board* board = new OpenIP::Board("MyWindow",640,480,new OpenIP::ColorRGB(255,255,255));

2. 窗口事件绑定

 board->setEventHandling();

3. 窗口渲染

 board->run();

图片操作

1. 读取png图片为RGB矩阵std::vector<std::vector<ColorRGB*>>

 PNGLoader *pngloader = new PNGLoader();
        std::vector<std::vector<ColorRGB *>> pixelsMap = pngloader->loadPNG("yz.png");

2.读取图像到PixelMap

PixelMap* pixelMap = new PixelMap(0, 0, width, height, new ColorRGB(255, 255, 255));
        pngLoader->loadPNGToPixelMap("yz.png",pixelMap);

3. PixelMap 像素矩阵

PixelMap* pixelmap = new PixelMap(0, 0, this->width / 4, this->height / 2, new ColorRGB(255, 255, 255));

3. PixelMap像素矩阵像素填充

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);

图像处理

1. 图像滤波

中值滤波

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();

字体

1. 字体渲染

初始化

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);

渲染

font->render();