Learning opencv: Filter series (5) -- radial blur: Scaling & Rotating

Source: Internet
Author: User

========================================================== ======

Copyright: bear does not go to the lab csdn blog

========================================================== ======

Working principle: Game render

This effect has been seen in the switching scenario of gash 4, and the motion blur of speed 12 also has this feeling.

PS is called radial fuzzy-> scaling, and a radial fuzzy-> rotation.

Scaling principle:

Determine a central point (such as 0.5, 0.5), connect to the current pixel, take the current pixel as the center, sample nearby pixels online, and take the average value at last.

Similarly, the rotation principle is similar, that is, the mean in a certain area with the same radius.

The radius and angle of the image are changed during scaling and rotation.


Using opencv


Source image:


Radial Blur-> Scaling:



# Include <math. h> # include <opencv/cv. h> # include <opencv/highgui. h> using namespace CV; using namespace STD; int num = 40; // num: Mean strength; int main () {mat src = imread ("D:/test3.jpg ", 1); MAT src1u [3]; split (SRC, src1u); int width = SRC. cols; int heigh = SRC. rows; mat img; SRC. copyto (IMG); Point Center (width/2, heigh/2); For (INT y = 0; y 

Radial Blur-> Rotation:



# Include <math. h> # include <opencv/cv. h> # include <opencv/highgui. h> using namespace CV; using namespace STD; int num = 20; // mean strength; int main () {mat src = imread ("D:/test3.jpg", 1 ); mat src1u [3]; split (SRC, src1u); int width = SRC. cols; int heigh = SRC. rows; mat img; SRC. copyto (IMG); Point Center (width/2, heigh/2); For (INT y = 0; y 


Principle reference:

Http://blog.csdn.net/xoyojank/article/details/5146297

Http://bbs.9ria.com/thread-111831-1-1.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.