00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00029
00030 #include <QtGui/QtGui>
00031 #include <QColor>
00032
00033 #include "tests/data.hh"
00034
00035 #include <mln/core/image/image2d.hh>
00036 #include <mln/value/rgb8.hh>
00037 #include <mln/value/int_u8.hh>
00038 #include <mln/io/ppm/load.hh>
00039 #include <mln/io/pgm/load.hh>
00040 #include <mln/data/convert.hh>
00041
00042 #include <mln/convert/to_qimage.hh>
00043
00044
00045 int main()
00046 {
00047 using namespace mln;
00048
00049 {
00050 image2d<value::int_u8> input;
00051 io::pgm::load(input, MLN_IMG_DIR "/picasso.pgm");
00052 QImage test = convert::to_qimage(input);
00053 QImage refpix(MLN_IMG_DIR "/picasso.pgm");
00054
00055
00056
00057 for (int row = 0; row < test.height(); ++row)
00058 for (int col = 0; col < test.width(); ++col)
00059 mln_assertion(refpix.pixel(col, row) == test.pixel(col, row));
00060 }
00061
00062 {
00063 image2d<value::rgb8> input;
00064 io::ppm::load(input, MLN_IMG_DIR "/picasso.ppm");
00065 QImage test = convert::to_qimage(input);
00066 QImage refpix(MLN_IMG_DIR "/picasso.ppm");
00067
00068 test = test.convertToFormat(refpix.format());
00069
00070
00071
00072 for (int row = 0; row < test.height(); ++row)
00073 for (int col = 0; col < test.width(); ++col)
00074 mln_assertion(refpix.pixel(col, row) == test.pixel(col, row));
00075 }
00076 }