Module: DatasetsGdkPixbuf::CIFARPixbufable
- Included in:
- Datasets::CIFAR::Record10, Datasets::CIFAR::Record100
- Defined in:
- lib/datasets-gdk-pixbuf/cifar.rb
Instance Method Summary collapse
Instance Method Details
#to_gdk_pixbuf ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/datasets-gdk-pixbuf/cifar.rb', line 5 def to_gdk_pixbuf n_channels = 3 width = 32 height = 32 color_size = width * height rgb_data = pixels.each_slice(color_size).to_a.transpose.flatten rgb_data = rgb_data.pack("C*") GdkPixbuf::Pixbuf.new(:data => rgb_data, :row_stride => width * n_channels, :width => width, :height => height) end |