Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.

need help for sepia

tarifut
Beginner
160 Views
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
0 Kudos
3 Replies
Naveen_G_Intel
Employee
160 Views

Hi,

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.

Regards,

Naveen Gv

Sergey_K_Intel
Employee
160 Views
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;
Vladimir_Dudnik
Employee
160 Views
Note, we also provide an example of sepia transform within Deferred Mode Image Processing (DMIP) sample.

Regards,
Vladimir
Reply