I have two different images for the same object. Each one was taken from different device (scanner, mobile camera, professional camera ..etc). the process of registeration one of them to the other was done correctly. Now I need to do a subtraction between to them for comparison purpose. The problem that is the contrast and brightness are pretty different. I tried these two methods (I tried them on the whole image(globally) and on pairs of the two images (locally)):

  1. Gray-Scale method:

    ImageB= ImageA * (Mean_Of(ImageA)/Mean_Of(ImageB));

  2. Color method: Convert it to HSV then:

    ImageB[S]= ImageA[S] * (Mean_Of(ImageA[S])/Mean_Of(ImageB[S])); ImageB[V]= ImageA[V] * (Mean_Of(ImageA[V])/Mean_Of(ImageB[V]));

return to RGB again

However, the two methods did not give me the results I want. They are good and work well on many images but not in all cases.

Any suggestions? Many thanks


1 Answer 1

  1. The images you are working with are probably with gamma compensation, you should remove it first by applying inverse gamma.
  2. More accurately, each camera has its own tone curve mapping. You can build a lookup table that converts one from another.
  3. After you removed the non-linearity source, (whether you used method 1 or method 2), as a first order approximation, you can map colors from different cameras by using a 3x3 matrix applied on RGB.

Now you can compare your images.

  • $\begingroup$ Thank you I am going to start with the first method and if it did not work, I would try the secound. but the third note may please give a clue about what you mean by "by using a 3x3 matrix applied on RGB." $\endgroup$ Commented May 6, 2015 at 5:20
  • 1
    $\begingroup$ @HumamHelfawi, try to google "Color correction matrix" $\endgroup$ Commented Jul 7, 2015 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.