Commit d505a70f authored by Declara Denis's avatar Declara Denis Committed by Christian Schulte zu Berge
Browse files

Wired the reset weights button in ConfidenceMapsSolver to the actual logic

parent aca4c040
......@@ -17,9 +17,10 @@ public:
virtual const float* getSolution(int &width, int &height) const;
private:
// Input image data
int width, height;
private:
// Matrices and Vectors
CuspGPUData* gpuData;
......
......@@ -64,10 +64,13 @@ namespace campvis {
CudaConfidenceMapsSolver::~CudaConfidenceMapsSolver() { }
void CudaConfidenceMapsSolver::init() {
//CUSP_CM_initCuda();
p_resetResult.s_clicked.connect(this, &CudaConfidenceMapsSolver::resetSolutionVector);
resetSolutionVector();
}
void CudaConfidenceMapsSolver::deinit() { }
void CudaConfidenceMapsSolver::deinit() {
p_resetResult.s_clicked.disconnect(this);
}
void CudaConfidenceMapsSolver::updateResult(DataContainer& data) {
......@@ -101,4 +104,17 @@ namespace campvis {
}
void CudaConfidenceMapsSolver::updateProperties(DataContainer& dataContainer) { }
void CudaConfidenceMapsSolver::resetSolutionVector() {
// Create a linear gradient image of the same size as the input image
size_t elementCount = _solver.width * _solver.height;
std::vector<float> gradient(elementCount);
for(size_t i = 0; i < elementCount; ++i) {
float value = static_cast<float>(i / _solver.width) / static_cast<float>(_solver.height-1);
gradient[i] = value;
}
_solver.setInitialSolution(gradient);
}
}
\ No newline at end of file
......@@ -94,6 +94,7 @@ namespace campvis {
protected:
void resetSolutionVector();
CuspConfidenceMapSolver _solver;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment