看來任何圖像處理庫都可以滿足您的需求。所以,我的建議是使用一個儘可能簡單的庫來集成到你的構建過程中。 在這種情況下,CImg庫對我們來說非常簡單,因爲它由一個簡單的.h文件組成。
關於你的需要,一個可能的實現將是
#include "CImg.h"
using namespace cimg_library;
int main(int argc,char **argv)
{
CImg<unsigned char> image("img/logo.bmp");
//Simple resize with nearest neighbour interpolation
//image = image.resize(64, 64);
//If you want to specify the interpolation type
image = image.resize(64, 64, -100, -100, 4);//The last param specifies the interpolation type
//\param interpolation_type Method of interpolation :
// -1 = no interpolation : raw memory resizing.
// - 0 = no interpolation : additional space is filled according to \p border_condition.
// - 1 = nearest-neighbor interpolation.
// - 2 = moving average interpolation.
// - 3 = linear interpolation.
// - 4 = grid interpolation.
// - 5 = bicubic interpolation.
// - 6 = lanczos interpolation.
CImgDisplay main_disp(image,"Image resized");
//This last part of code is not usfeul for you, it is only used to display the resized image
while (!main_disp.is_closed())
main_disp.wait();
return 0;
}
那麼,究竟是什麼問題了嗎?打開文件?要讀取數據?將數據轉換爲您的ANN庫期望的格式?請更精確。請注意,如果您有多個問題,則可能會打開多個問題。這樣做是爲了使每個問題的實際問題的數量儘可能接近1。 – moooeeeep 2012-01-03 22:17:41
@moooeeeep我已更新我的問題。請看看它是否更好。 – Patryk 2012-01-03 22:28:44
X中每隔6個像素,Y中每隔3個像素。不夠優雅,但可以作爲第一遍,直到找到更好的低分辨率解決方案。 – 2012-01-03 22:46:28