MCPcopy Create free account
hub / github.com/Image-Py/imagepy / match

Function match

imagepy/menus/Image/Adjust/histogram_plgs.py:23–46  ·  view source on GitHub ↗
(img1, img2)

Source from the content-addressed store, hash-verified

21 return hist
22
23def match(img1, img2):
24 if img1.ndim == 2:
25 temp = np.histogram(img1, np.arange(257))[0]
26 if img2.ndim == 2:
27 hist = np.histogram(img2, np.arange(257))[0]
28 ahist = like(temp, hist)
29 img2[:] = ahist[img2]
30 if img2.ndim == 3:
31 for i in range(3):
32 hist = np.histogram(img2[:,:,i], np.range(257))[0]
33 ahist = like(temp, hist)
34 img2[:,:,i] = ahist[img2[:,:,i]]
35 elif img1.ndim == 3:
36 if img2.ndim == 2:
37 temp = np.histogram(img1, np.arange(257))[0]
38 hist = np.histogram(img2, np.arange(257))[0]
39 ahist = like(temp, hist)
40 img2[:] = ahist[img2]
41 if img2.ndim == 3:
42 for i in range(3):
43 temp = np.histogram(img1[:,:,i], np.arange(257))[0]
44 hist = np.histogram(img2[:,:,i], np.arange(257))[0]
45 ahist = like(temp, hist)
46 img2[:,:,i] = ahist[img2[:,:,i]]
47
48class Normalize(Filter):
49 title = 'Histogram Normalize'

Callers 1

runMethod · 0.85

Calls 2

likeFunction · 0.85
histogramMethod · 0.80

Tested by

no test coverage detected