java - How to calculate the distance from a pixel in the Lab-color space to a specific prototype -
i have lab-image
, each pixel in it, want know how red, green, blue , yellow pixel is.
which means, input lab-image
should 4 images 1 red,green,blue , yellow.
as far researched, knew done calculating ecludian distance each pixel in lab-image
prototype of color (r,g,b or y). example, if want produce image contains how red pixels in lab-image
, each pixel in lab-image
, have calculate distance pixel in lab-image
prototype of red color in lab-color space
kindly please provide advice , guidance.
all need convert color value need (e.g. red = 255,0,0 in rgb) lab (lref,aref,bref), calculate euclidean distance between each pixel , value, , set distance output pixel value.
out_pixel=sqrt(sqr(lpixel-lref)+sqr(apixel-aref)+sqr(bpixel-bref))
you may want normalize values, if want pixel output fit in 0-255.
Comments
Post a Comment