Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication5.cpp : Defines the entry point for the console
- application.
- //
- #include "stdafx.h"
- #include <opencv2/core.hpp>
- #include <opencv2/highgui.hpp>
- #include <stdio.h>
- #include <algorithm>
- #include <array>
- #include <chrono>
- #include <random>
- int main()
- {
- /*
- This is used to randomize the images.
- */
- std::array<int, 25> randomshuffle;
- for (int i = 0; i < 25; i++)
- {
- randomshuffle[i] = i;
- }
- unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
- std::shuffle(randomshuffle.begin(), randomshuffle.end(),
- std::default_random_engine(seed));
- for (int &x : randomshuffle) std::cout << ' ' << x;
- std::cout << 'n';
- std::array<int, 4> label = { 0, 1, 2, 3};
- for (int i = 0; i < 4; i++)
- {
- label[i] = i;
- }
- /*
- This is used to import the images using the random image and label.
- */
- for (int i = 0; i < 5; i++)
- {
- std::string z = "";
- unsigned seed2 =
- std::chrono::system_clock::now().time_since_epoch().count();
- std::shuffle(label.begin(), label.end(),
- std::default_random_engine(seed2));
- if (label[0] == 0)
- {
- z = "Standing";
- }
- else if (label[0] == 1)
- {
- z = "Sitting";
- }
- else if (label[0] == 2)
- {
- z = "Laying";
- }
- else if (label[0] == 3)
- {
- z = "Active";
- }
- cv::Mat image;
- int x = 0;
- std::string path = "D:\Motion\data\inputs\master\" + z +
- std::to_string(randomshuffle[i]) + ".jpg";
- image = cv::imread(path);
- imshow(z + " " + std::to_string(i), image);
- cv::waitKey(10000);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment