Moved MNIST sample to QImage conversion to MNIST loader

This commit is contained in:
mandlm 2015-11-01 15:00:32 +01:00
parent eecd7a0fe6
commit 1d343a079a

View File

@ -6,6 +6,8 @@
#include <memory> #include <memory>
#include <inttypes.h> #include <inttypes.h>
#include <QImage>
class MnistLoader class MnistLoader
{ {
private: private:
@ -21,6 +23,11 @@ public:
public: public:
uint8_t label; uint8_t label;
uint8_t data[SAMPLE_WIDTH * SAMPLE_HEIGHT]; uint8_t data[SAMPLE_WIDTH * SAMPLE_HEIGHT];
QImage toQImage() const
{
return QImage(data, SAMPLE_WIDTH, SAMPLE_HEIGHT, QImage::Format_Grayscale8);
}
}; };
using MnistSample = Sample<SampleWidth, SampleHeight>; using MnistSample = Sample<SampleWidth, SampleHeight>;