Skip to content

How to use HSV color format instead of LAB? #2

@rakeshwar07

Description

@rakeshwar07

#Change HSV, making it more natural,optional

im[x, y] = color.lab2rgb(val.reshape(len(x), 1, 3)).reshape(len(x), 3) * 255

hsv_val = cv2.cvtColor(im,cv2.COLOR_BGR2HSV)

hsv_val2=hsv_val[x,y]

L3,A3,B3=mean(hsv_val2[:, 0]), mean(hsv_val2[:, 1]),mean(hsv_val2[:, 2])

hsv_val2[:,0]-=0

hsv_val2[:,1]-=0

hsv_val2[:,2]+=0

I changed the above code like "# #Change RGB color

val = color.rgb2lab((im[x, y] / 255.).reshape(len(x), 1, 3)).reshape(len(x), 3)

L, A, B = mean(val[:, 0]), mean(val[:, 1]), mean(val[:, 2])

L1, A1, B1 = color.rgb2lab(np.array((r / 255., g / 255., b / 255.)).reshape(1, 1, 3)).reshape(3, )

ll, aa, bb = L1 - L, A1 - A, B1 - B

val[:, 0] +=ll*inten

val[:, 1] +=aa*inten

val[:, 2] += bb*inten " but the result was very bad.

Could you pls show how to use the hsv instead of lab?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions