문제

Please i need help regarding changes of color space

I have calculate Y, Cr , Cb values using conversion

            int Y = (int)(0.299*r+0.587*g+0.114*b);
            int Cb=(int)(128-0.169*r-0.331*g+0.500*b);
            int Cr =(int)(128+0.500*r-0.419*g-0.081*b);

Now i have to save new image with new color space e.g YCrCb not RGB what should i follow.

도움이 되었습니까?

해결책

You can display the image in YCbCr space using bufferedImage class in java. For this create an empty buffered image of size same as your RGB image and set all the pixel values using setRGB method as shown below.

BufferedImage ycb =  new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);

int val = (y<<16) | (cb<<8) | cr;
    ycb.setRGB(i,j,val);

ImageIO.write(ycb,"png", new File("E:\\Rose\\ycbcr\\ycbcr.png"));
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top