C++ (Qt) boost::gil::rgb8_image_t img; boost::gil::read_image("photo.png", img, boost::gil::png_tag()); boost::gil::rgb8_view_t view = boost::gil::view(img);
C++ (Qt)std::random_device rd; std::mt19937 gen(rd()); std::uniform_int_distribution<size_t> dist_x(0, view.width()-1); std::uniform_int_distribution<size_t> dist_y(0, view.height()-1); specmath::compsci::vanda vanda; auto start = std::chrono::high_resolution_clock::now(); for (size_t i = 0; i < TRAINING_SIZE; ++i) { /* choose random pixel coordinates */ size_t xi = dist_x(gen); size_t yi = dist_y(gen); boost::gil::rgb8_pixel_t pixel = view(xi, yi); /* * input data vec_t{xi, yi}, * output data vec_t{R, G, B} */ dataset.add( { double(xi), double(yi) }, { double(pixel[0]), double(pixel[1]), double(pixel[2]) } ); }