Mutual conversion between Cartesian (x, y) spaces and data polar coordinates (log R, angle PHI)

Source: Internet
Author: User

Principle:

Polar Coordinate is a constant representation of the object's field of view. For example, all squares are the same, resulting in a class of two-dimensional rotation and scale immutability.

ROV = m * log (SQRT (X2 + y2 ))

Phi = atan (y/X)

Core functions:

Cvlogpolar

Effect:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/D3/wKiom1PsKpiwtjKEAADnFIOZh1M388.jpg "style =" float: none; "Title =" clipboard1.png "alt =" wkiom1pskpiwtjkeaadnfiozh1m388.jpg "/>

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/D4/wKioL1PsK7Hhq8QkAAFKAciw63g529.jpg "style =" float: none; "Title =" clipboard2.png "alt =" wkiol1psk7hhq8qkaafkaciw63g529.jpg "/>

Code:

# Include "CV. H "# include" cxcore. H "# include" highgui. H "# include <iostream> int logpolar (INT argc, char ** argv) // polar: two levels, polar {iplimage * src = cvloadimage (" E: \ picture \ zenfanxin. jpg "); iplimage * DST = cvcreateimage (cvgetsize (SRC), Src-> depth, Src-> nchannels); iplimage * src2 = cvcreateimage (cvgetsize (SRC ), src-> depth, Src-> nchannels); double M = 80; // it seems that the larger the range of m, the clearer the restored image cvlogpolar (SRC, DST, cvpoint2d32f (SRC-> width/2, Src-> height/4), M, cv_inter_linear | cv_warp_fill_outliers); // cv_inter_linear: bilinear interpolation. outliers: out-of-office by default, cartesian coordinate conversion for multiple polar coordinates cvlogpolar (DST, src2, cvpoint2d32f (SRC-> width/2, Src-> height/4), M, cv_inter_linear | cv_warp_inverse_map ); // The number-pole coordinate transformation is the Cartesian coordinate cvnamedwindow ("src"); cvnamedwindow ("DST"); cvnamedwindow ("src2"); cvshowimage ("src", Src ); cvshowimage ("DST", DST); cvshowimage ("src2", src2); cvwaitkey (0); cvdestroywindow ("src"); cvdestroywindow ("DST "); cvdestroywindow ("src2"); cvreleaseimage (& SRC); cvreleaseimage (& DST); cvreleaseimage (& src2); Return 0 ;}


This article is from the "flyclc" blog, please be sure to keep this source http://flyclc.blog.51cto.com/1385758/1539816

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.