Ask Your Question
1

How to implement filters ?

asked Mar 20 '14

FLY gravatar image

updated Jan 18 '16

I am trying to make filters like sepia filter in my app like other photo editing applications , till now I don't have any idea about it , Can any one help me out for it about its algorithms and how to do it ? and Can I implement in opencv using native c++ or we have any of its build in functions ?

Preview: (hide)

2 answers

Sort by » oldest newest most voted
3

answered Mar 21 '14

berak gravatar image

updated Mar 21 '14

i can give you a c++ answer only, but looking at this it should be quite easy:

Mat img = imread("lena.jpg");
Mat_<float> sepia(3,3); 
//sepia << .393,.769,.189  // rgb
//        ,.349,.686,.168
//        ,.272,.534,.131;
sepia << .131,.534,.272    // bgr (rows as well as cols swapped)
        ,.168,.686,.349
        ,.189,.769,.393;
Mat out;
cv::transform(img,out,sepia);
imshow("i",out);
waitKey();

image description

Preview: (hide)

Comments

@berak my good helper :P so do we need to be strong in photoshop to get these values if we make our own filters ? or we simply need hit and trail

FLY gravatar imageFLY (Mar 22 '14)edit

you want an elephant brain, and you want to get good at math, no ? ;-]

berak gravatar imageberak (Mar 22 '14)edit
-1

answered Mar 21 '14

wuling gravatar image
Preview: (hide)

Comments

but can i use it in a native c++ or in opencv ?

FLY gravatar imageFLY (Mar 21 '14)edit

Question Tools

Stats

Asked: Mar 20 '14

Seen: 2,792 times

Last updated: Mar 21 '14