I'm trying to modify this code I found here for my Thesis : https://github.com/carolinepacheco/lbp-library, so that it creates a new directory in C:, and there stores the modified pictures I loaded. Problem is, that I can only get the new directory created, but have yet to make the code load all the pictures from a folder I got on my desktop (DRIVE Retinal Dataset - "C:\Users\Vassilis\Desktop\DriveFinal\*.TIF"), and then modify them. I'm uploading the code too, and hope for your support...
#include <opencv2/opencv.hpp>
#include <vector>
#include <String>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <direct.h>
#include "lbplibrary.hpp"
using namespace lbplibrary;
using namespace std;
stringstream ss;
void makedir()
{
if (_mkdir("\\drivemodded") == 0)
{
printf("Directory '\\drivemodded' was successfully created, lbp images can now be stored\n");
system("dir \\drivemodded");
}
else
printf("Problem creating directory '\\drivemodded', maybe it already exists...\n");
}
void test_image()
{
String folder = "C:\\Users\\Vassilis\\Desktop\\DriveFinal\\*.TIF";
vector<cv::String> filenames;
cv::Mat img_output;
cv::Mat img_input;
cv::Mat ct; //mhpws = 0 ???
cv::glob(folder, filenames);
//cv::Mat img_input = cv::imread("frames/1.png");
for (size_t i = 0; i < filenames.size(); i++)
{
cv::Mat img_input = cv::imread(filenames[i]);
cv::imshow("Input", img_input);
cv::cvtColor(img_input, img_input, cv::COLOR_BGR2GRAY);
//cv::GaussianBlur(img_input, img_input, cv::Size(7, 7), 5, 3, cv::BORDER_CONSTANT);
LBP* lbp;
lbp = new OLBP; // 0-255
//lbp = new ELBP; // 0-255
//lbp = new VARLBP; // 0-953.0
//lbp = new CSLBP; // 0-15
//lbp = new CSLDP; // 0-15
//lbp = new XCSLBP; // 0-15
//lbp = new SILTP; // 0-80
//lbp = new CSSILTP; // 33-120
//lbp = new SCSLBP; // 0-15
//lbp = new BGLBP; // 0-239
lbp->run(img_input, img_output);
double min, max; cv::minMaxLoc(img_output, &min, &max); std::cout << "min: " << min << ", max: " << max;
cv::normalize(img_output, img_output, 0, 255, cv::NORM_MINMAX, CV_8UC1);
cv::imshow("Output", img_output);
cv::imwrite("C:\\drivemodded", img_output);
}
cv::waitKey(0);
}
int main(int argc, const char** argv)
{
makedir();
test_image();
return 0;
}