image filters
DESCRIPTION
TRANSCRIPT
IMAGE BLEND MODES
Image blend modes“Modes determine how two layers are blended into each other” – Wikipedia
Really nice looking image filters can be created using two of the most basic image blend modes
•OVERLAY•ADD(Most of the filters in InPlaces app uses just these two blends)(screenshot of image blending modes available in
Adobe Photoshop)
EXAMPLE
FilmThick filterUses just the Overlay and Add blend mode & is a result of two very basic steps if you use Photoshop or any other image editing software.
(screenshot from InPlaces app with FilmThick filter)
FILMTHICK FILTER
STEP 1 : Duplicate layer_1 as layer_2 and do the overlay
STEP 2 : Create a new layer_3 with RGB (154, 0, 205) & alpha at 22% and add it over layer_1 and layer_2
Try this with your favorite photo editing tool (Adobe Photoshop, Corel PhotoPaint)
DOING IT WITH OPENCV
OpenCV is a library of programming functions for real time computer vision. In simple words playing with your images and videos.
Modules of OpenCVcore, imgproc, video, calib3d, features2d, objdetect, highgui, gpu
All you needimgproc module
Website : http://opencv.org
OPENCV BASICS
How we see How OpenCV sees, A Matrix (data type: cvMat)
NOTE: RGB image has 3 layers &could be split into the contributing 3 channels usingOpenCV’s split() function
THE CODE
cv::Mat filmThick (cv::Mat src){cv::Mat colorTone;
src = overlay(src, src);
colorTone = cv::imread("rgb_154_0_205.jpg“);
addWeighted(src, 1.0, colorTone, 0.22, 0, src);
return (src);}
(Result of Step 1 from Slide 4)
(Result of step 2)
THE CODE – FUNCTIONS()
addWeightedOpenCV comes with the addWeighted function. This is nothing but the "Add" blend you see in Photoshop. Check doc here
OverlayOpenCV does not come with a function to perform overlay blend. So we had to code it.
Technically the algorithm happens to bereturn (v2 < 128) ? (2 * v1 * v2 / 255):(255 - 2 * (255 - v1) * (255 - v2) / 255);
V1 being the intensity of any given pixel from the sourceV2 being the intensity of any given pixel from the overlaying image
THE CODE - EXPLAINED
https://gist.github.com/inplacesapp/5415458
Check out the sample C++ code
ONE MORE TIP
Vignetting
THE END
www.inplac.es“inplacesapp” on twitter & facebook