X-Git-Url: http://www.fmaj7b5.info/git?p=cuda.git;a=blobdiff_plain;f=imageio_test%2Fimageio_test.cpp;fp=imageio_test%2Fimageio_test.cpp;h=c07c42bac23c59c614b05652786fd69b09e7b89b;hp=0000000000000000000000000000000000000000;hb=8b2c111ed060599c6bc93b48732d36f8aa48eb2b;hpb=3b1cd69345c4ba6a4357dba81e988ebc66665392 diff --git a/imageio_test/imageio_test.cpp b/imageio_test/imageio_test.cpp new file mode 100644 index 0000000..c07c42b --- /dev/null +++ b/imageio_test/imageio_test.cpp @@ -0,0 +1,53 @@ +/* + Copyright (C) 2012 fmaj7b5.info + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +// imageio_test.cpp : ƒRƒ“ƒ\[ƒ‹ ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚̃Gƒ“ƒgƒŠ ƒ|ƒCƒ“ƒg‚ð’è‹`‚µ‚Ü‚·B +// + +#include "stdafx.h" + +#include "Image.h" +#include "ImageIO.h" + +using namespace FM7b5; + +int _tmain(int argc, _TCHAR* argv[]) +{ + ImageGray image; + + try { + image = loadPGM("..\\img\\sine.pgm"); + } + catch (std::exception& e) + { + std::cout << e.what() << std::endl; + return -1; + } + + /* invert pixel values */ + ImageGray out(image.width(), image.height()); + for (size_t h = 0; h < image.height(); ++h) { + for (size_t w = 0; w < image.width(); ++w) { + out(w, h) = 255 - image(w, h); + } + } + + savePNM(out, "result.pgm"); + + return 0; +} +