Welcome to 16892 Developer Community-Open, Learning,Share
menu search
person

Categories

I'm trying to find the color invariants of a photo. I searched it and found that I need to find the value of c1 as its simplest feature. We can find c1 by this formula c1=(r/max(g,b)).

When I try to find img cols and rows with img.shape and split this image b,g,r.

import cv2
import math
import matplotlib.pyplot as plt

img = cv2.imread('CU.png')

b,g,r = cv2.split(img)

cv2.imshow('Image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

print(img.shape)
rows,cols,channels = img.shape
for i in range(rows):
    for j in range(cols):
        b = img[i,j,0]
        g = img[i,j,1]
        r = img[i,j,2]
        x = (r/max(g,b))
        c1= math.atan(x)
        plt.plot(i,j,c1)

plt.show()

I thought I should split the picture into rows and columns and then break it down into b, g, r. I had to find c1 using the values b, g, r in each row and column, but I'll do this c1 later.

I wonder if anyone knows about it? How to find color constants or what should I do or is my method of finding this c1 correct?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
62 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to 16892 Developer Community-Open, Learning and Share

548k questions

547k answers

4 comments

32.8k users

...