color match in images
Asked Answered
A

2

8

I have two images (slices) which were taken by two camera sensors to complete one image. However, due to some differences in sensors' performance, the colour/tones of them are different and I need to match them to make one unified image.

I used the HistogramMatcher function that is included in Fiji (Image J) explained here to match the colours of the second image as the first one. It gives an acceptable result but still needs further processing.

So my question is, what are the best approaches to have a unified image. should I start with brightness, hue then saturation? Also is there other than 'HistogramMatcher' function to match colours?

below is an example of an image

enter image description here

Adenosine answered 7/7, 2019 at 2:0 Comment(0)
T
9

I split your image in two as follows, then used scikit-image's histogram matching function:

enter image description here enter image description here

#!/usr/bin/env python3

import numpy as np
from skimage.io import imread, imsave
from skimage import exposure
from skimage.transform import match_histograms

# Load left and right images
L = imread('rocksA.png')
R = imread('rocksB.png')

# Match using the right side as reference
matched = match_histograms(L, R, multichannel=True)

# Place side-by-side and save
result = np.hstack((matched,R))
imsave('result.png',result)

That gives this result:

enter image description here

Torrefy answered 9/7, 2019 at 13:23 Comment(0)
F
5

For comparison, I have two Imagemagick bash shell scripts that transfer color from one image to another. (see http://www.fmwconcepts.com/imagemagick/index.php). One does color histogram matching and the other does color adjustment by matching mean and standard deviation (i.e. brightness and contrast).

I will use Mark Setchell's separated images.

Input

enter image description here enter image description here

Histogram Matching:

histmatch -c rgb right.png left.png newleft_histmatch.png

convert newleft_histmatch.png right.png +append result_histmatch.png


enter image description here

Mean/Std Matching:

matchimage -c rgb left.png right.png newleft_matchimage.png

convert newleft_matchimage.png right.png +append result_matchimage.png


enter image description here

For a Python/OpenCV solution to color transfer using mean and standard deviation, see https://www.pyimagesearch.com/2014/06/30/super-fast-color-transfer-images/

Febri answered 9/7, 2019 at 16:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.