Hi I am trying to extract the lighting and the shadow from one surface and apply it to another type of surface. I convert the image to HSV and extract the Hue component and plot it which seems to give me a good indication of where the lighting and shadows are. However when I swap the hue component of the original image with my final image I get all sorts of greens and blues that are not desired. Are there any other techniques that can be used to project shadow and lighting?
cvtColor( img0, hsv, CV_BGR2HSV );
components[0].create( hsv.size(), 1);
components[1].create( hsv.size(), 1);
components[2].create( hsv.size(), 1);
split(hsv, components);
...
cvtColor( drawing, hsv_output, CV_BGR2HSV );
components_output[0].create( hsv.size(), 1);
components_output[1].create( hsv.size(), 1);
components_output[2].create( hsv.size(), 1);
split(hsv_output, components_output);
components_output[0] = 0.5 * components_output[0] + 0.5 * components[0];
int ch[] = {0 , 0};
mixChannels(&components_output[0], 1, &hsv_output, 1, ch, 1);
cvtColor( hsv_output, drawing, CV_HSV2BGR );