need help for sepia

need help for sepia

Hi everyone!I don't know how to make sepia on a picture with opencv.I can't find any clue to make this.Could you help me?Thanks

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.


Sepia on a picture is basically color conversion, Intel IPP has got several APIs for this type of operation, like Color models conversion, Gamma correction, Color twist, Color keying etc. I am sure you can use IPP for sepia on an image.

Sorry, I dont know how to do it using OpenCV, also this forum is intended for Intel IPP discussion, feel free to share your experience on using IPP for sepia.


Naveen Gv

With the IPP you may do the following

// Convert RGB to gray
IppiSize roi;
roi.width = uiWidth;
roi.height = uiHeight;
status = ippiRGBToGray_8u_C3C1R((const Ipp8u*)uiInputImage, uiWidth*3, (Ipp8u*)pGrayImage, stepBytes, roi);

// Copy gray channels to color image
status = ippiDup_8u_C1C3R((const Ipp8u*)pGrayImage, stepBytes, (Ipp8u*)uiOutputImage, uiWidth*3, roi);

//Shift colors
const Ipp8u movColor[3] = { 162, 138, 101 };
status = ippiAddC_8u_C3IRSfs(movColor, (Ipp8u*)uiOutputImage, uiWidth*3, roi, 1);

Actually, sepia is

// Shift colors
unsigned int newR, newG, newB;
newR = (unsigned int)(R * 0.393 + G * 0.769 + B * 0.189); if (newR > 255) newR = 255;
newG = (unsigned int)(R * 0.349 + G * 0.686 + B * 0.168); if (newG > 255) newG = 255;
newB = (unsigned int)(R * 0.272 + G * 0.534 + B * 0.131); if (newB > 255) newB = 255;


Note, we also provide an example of sepia transform within Deferred Mode Image Processing (DMIP) sample.


Leave a Comment

Please sign in to add a comment. Not a member? Join today