0

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  );
  • 1
    Show us your relevant code. – Robert Harvey May 01 '13 at 23:30
  • The problem with recovering hue from a shadow is that the information is lost or becomes rather noisy at low light levels, especially when you convert from RGB to HSV. So you are likely to have larger errors in the detected hue for darker shadows. – paddy May 02 '13 at 00:34
  • I'm not trying to extract the hue from the shadow. Rather I am trying to find the light intensity of a region, and the hue of the image seemed to show the relevant places where there is a shadow, and where the light intensity is high. But I cant use that to project that light intensity on another surface... – user2242037 May 02 '13 at 00:42

0 Answers0