Skip to content
Snippets Groups Projects
Commit a381638e authored by Leonardo de Lima Gaspar's avatar Leonardo de Lima Gaspar
Browse files

Hog-ified the dataset

parent bd80fab4
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@ set(OpenCV_DIR "C:\\CPP Libs\\oomga\\build" )
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable(opencvtest main.cpp)
add_executable(opencvtest trainAndSerialize.cpp)
target_link_libraries( opencvtest ${OpenCV_LIBS} )
......
#include <iostream>
#include <filesystem>
#include <vector>
#include <opencv2/opencv.hpp>
#include <opencv2/objdetect.hpp>
using namespace std;
using namespace cv;
namespace fs = filesystem;
int imgWidth = 480;
int imgHeight = 270;
int main(int argc, char** argv) {
int labels[2] = {0, 1};
vector<vector<float>> noFishHogVec;
vector<vector<float>> fishHogVec;
HOGDescriptor *hog = new HOGDescriptor();
for(auto const& file : fs::directory_iterator("dataset/noFish/")) {
vector<float> descriptor;
vector<Point> points;
hog->compute(imread(file.path().string(), IMREAD_GRAYSCALE), descriptor, Size(30,30), Size(0,0), points);
noFishHogVec.push_back(descriptor);
}
for(auto const& file : fs::directory_iterator("dataset/fish/")) {
vector<float> descriptor;
vector<Point> points;
hog->compute(imread(file.path().string(), IMREAD_GRAYSCALE), descriptor, Size(30,30), Size(0,0), points);
fishHogVec.push_back(descriptor);
}
cout << noFishHogVec.size() << endl;
cout << fishHogVec.size() << endl;
imshow("img", fishHogVec[20]);
waitKey(0);
destroyWindow("img");
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment