So, I'm trying to write an algorithm for adjusting the lighting around a camera to get the right grey levels in an image. I've measured grey levels at different lighting levels, and now I'm trying to get a relationship for grey levels across an area to light sources across that same area.
So far I've been doing this in OpenCV and C++, based on a prior prototype in MatLab. Part of the solution in MatLab involves using a Quadratic Solver (the function quadprog
), and I must admit to being a little out of my depth when it comes to Quadratic Programming. If possible I would really like to be able to implement this natively in OpenCV, so I don't have to use a different library, convert my Mats to its matrix standard, and then back to cv::Mats once more. Is there a way to do this natively? I have looked at the documentation for OpenCV solvers, but I'm not sure they're applicable in this case . . .
For reference, the MatLab I'm trying to implement looks like this, where H, F, A, B, LB and UB are matrices:
opt=optimset('Algorithm','active-set','Display','off');
[setpwm,fval,flag]=quadprog(H,F,A,B,[],[],LB,UB,[],opt);
"H represents the quadratic in the expression 1/2*x'Hx + f'*x. If H is not symmetric, quadprog issues a warning and uses the symmetrized version (H + H')/2 instead." - quadprog MatLab page
"F represents the linear term in the expression 1/2*x'Hx + F'*x." - quadprog MatLab page
"A is an M-by-N matrix, where M is the number of inequalities, and N is the number of variables." - quadprog MatLab page
"B contains the Linear inequality constraints, specified as a real vector." - quadprog MatLab page
LB and UB are vectors specifying the upper and lower bounds of the vector x.
Thank you! :)