使用Qwt在点云上绘制样条曲线

问题描述 投票:0回答:1

我有一组点,我想沿着一组点绘制样条线。我写了代码

QwtSplineCurveFitter curveFitter;
QPolygonF splinecurve = curveFitter.fitCurve(QPolygonF(whitepixels));
std::vector<cv::Point2d> polygonpoints ;
while(iter != splinecurve.end())
{
    polygonpoints.push_back(cv::Point2d(iter->x(),iter->y()));
    ++iter;
}
std::vector<cv::Point2d>::iterator itr = polygonpoints.begin();
cv::Point2d firstpoint;
cv::Mat whitemask;
whitemask = cv::Scalar::all(255);
while (itr != polygonpoints.end())
{
    if(*itr == polygonpoints.front())
    {
        firstpoint = *itr;
    }
    else
    {
        cv::line(img, firstpoint, *itr, cv::Scalar(0,255,0), 1);
        firstpoint = *itr;
    }
    ++itr;
}
cv::imshow("newline",whitemask);
cv::waitKey(0);

但是获得这样的图像。我想沿着这些点绘制样条曲线enter image description here

用于绘制样条线的点

 x: 615 y:  807 

 x: 616 y:  808.41 

 x: 617 y:  805.848 

 x: 617.476 y:  808.845 

 x: 618 y:  810.786 

 x: 618.69 y:  806.306 

 x: 619 y:  811.735 

 x: 619.472 y:  811.043 

 x: 620 y:  808.69 

 x: 620.053 y:  820.387 

 x: 620.976 y:  802.451 

 x: 621 y:  815.143 

 x: 621.312 y:  817.39 

 x: 622 y:  806.102 

 x: 622 y:  819.597 

 x: 622.433 y:  815.76 

 x: 623 y:  806.559 

 x: 623 y:  820.054 

 x: 623.324 y:  820.59 

 x: 624 y:  807.018 

 x: 624 y:  820.511 

 x: 624.223 y:  825.097 

 x: 624.996 y:  807.633 

 x: 625 y:  820.969 

 x: 625.134 y:  829.079 

 x: 625.964 y:  809.359 

 x: 626 y:  821.426 

 x: 626.065 y:  832.334 

 x: 626.907 y:  812.125 

 x: 627 y:  821.883 

 x: 627.018 y:  834.659 

 x: 627.828 y:  815.731 

 x: 628 y:  822.34 

 x: 628 y:  835.853 

 x: 628.733 y:  819.973 

 x: 629 y:  822.797 

 x: 629 y:  836.287 

 x: 629.628 y:  824.65 

 x: 630 y:  823.254 

 x: 630 y:  836.748 

 x: 630.517 y:  829.559 

 x: 631 y:  823.712 

 x: 631 y:  837.205 

 x: 631.405 y:  834.499 

 x: 632 y:  824.167 

 x: 632 y:  837.663 

 x: 632.512 y:  832.728 

 x: 633 y:  828.623 

 x: 633 y:  842.115 

 x: 633.704 y:  830.236 

 x: 634 y:  833.077 

 x: 634.004 y:  846.392 

 x: 634.78 y:  828.835 

 x: 635 y:  833.534 

 x: 635 y:  847.03 

 x: 635.679 y:  833.33 

 x: 636 y:  833.991 

 x: 636 y:  847.487 

 x: 636.57 y:  838.153 

 x: 637 y:  834.448 

 x: 637 y:  847.943 

 x: 637.458 y:  843.103 

 x: 638 y:  834.905 

 x: 638 y:  848.4 

 x: 638.348 y:  847.978 

 x: 639 y:  835.37 

 x: 639 y:  848.857 

 x: 639.244 y:  852.575 

 x: 639.999 y:  835.857 

 x: 640 y:  849.314 

 x: 640.153 y:  856.692 

 x: 640.974 y:  837.322 

 x: 641 y:  849.771 

 x: 641.078 y:  860.127 

 x: 641.922 y:  839.874 

 x: 642 y:  850.228 

 x: 642.026 y:  862.678 

 x: 642.847 y:  843.309 

 x: 643 y:  850.685 

 x: 643 y:  864.188 

 x: 643.648 y:  850.43 

 x: 644 y:  849.144 

 x: 644 y:  862.63 

 x: 644.742 y:  849.385 

 x: 645 y:  853.598 

 x: 645.107 y:  863.678 

 x: 646.001 y:  848.526 

 x: 646 y:  862.052 

 x: 646.992 y:  849.718 

 x: 647 y:  862.998 

 x: 647.85 y:  850.968 

 x: 648 y:  859.953 

 x: 648.398 y:  861.506 

 x: 649 y:  856.908 

 x: 649.032 y:  869.454 

 x: 649.999 y:  853.898 

 x: 650 y:  867.356 

 x: 650.718 y:  859.282 

 x: 651 y:  864.312 

 x: 651.249 y:  870.318 

 x: 652 y:  861.267 

 x: 651.999 y:  874.79 

 x: 652.946 y:  859.858 

 x: 653 y:  871.715 

 x: 653.683 y:  867.426 

 x: 654 y:  872.665 

 x: 654.57 y:  871.304 

 x: 655 y:  873.614 

 x: 655.455 y:  875.27 

 x: 656 y:  874.564 

 x: 656.341 y:  879.18 

 x: 657 y:  875.514 

 x: 657.268 y:  882.567 

 x: 658 y:  878.46 

 x: 658.374 y:  882.964 

 x: 659 y:  881.407 

 x: 659.486 y:  883.224 

 x: 660 y:  884.353 

 x: 660.598 y:  883.469 

 x: 661 y:  887.3 

 x: 661.706 y:  883.82 

 x: 662 y:  890.246 

 x: 662.804 y:  884.401 

 x: 663 y:  893.193 

 x: 663.731 y:  887.64 

 x: 664 y:  894.142 

 x: 664.944 y:  886.823 

 x: 665.001 y:  899.056 

 x: 666 y:  892.53 

 x: 666.5 y:  896.003 

 x: 667 y:  899.466 

 x: 667.999 y:  892.941 

 x: 668.066 y:  905.083 

 x: 669 y:  899.85 

 x: 669.683 y:  899.643 

 x: 670 y:  906.787 

 x: 670.706 y:  901.904 

 x: 671 y:  907.738 

 x: 671.578 y:  906.169 

 x: 672 y:  908.687 

 x: 672.198 y:  916.227 

 x: 673 y:  905.64 

 x: 673 y:  919.137 

 x: 673.677 y:  909.588 

 x: 674 y:  912.095 

 x: 674.031 y:  924.539 

 x: 674.957 y:  906.531 

 x: 675 y:  918.547 

 x: 675.294 y:  922.023 

 x: 676 y:  911.504 

 x: 676 y:  925 

 x: 676.666 y:  915.826 

 x: 677 y:  917.959 

 x: 677.027 y:  930.549 

 x: 677.951 y:  912.574 

 x: 678 y:  924.411 

 x: 678.258 y:  928.6 

 x: 679 y:  915.38 

 x: 679 y:  928.866 

 x: 679.381 y:  927.129 

 x: 680 y:  915.831 

 x: 680 y:  929.323 

 x: 680.234 y:  932.522 

 x: 680.978 y:  913.248 

 x: 681 y:  925.782 

 x: 681.017 y:  938.614 

 x: 681.864 y:  919.905 

 x: 682 y:  928.238 

 x: 682.029 y:  940.629 

 x: 682.888 y:  921.449 

 x: 683 y:  930.694 

 x: 683 y:  944.197 

 x: 683.61 y:  930.819 

 x: 684 y:  927.153 

 x: 684 y:  940.647 

 x: 684.253 y:  943.009 

 x: 684.985 y:  924.28 

 x: 685 y:  937.107 

 x: 685.019 y:  949.752 

 x: 685.76 y:  930.657 

 x: 686 y:  933.566 

 x: 686 y:  947.06 

 x: 686.404 y:  942.782 

 x: 687 y:  930.026 

 x: 687 y:  943.52 

 x: 687.029 y:  955.759 

 x: 687.783 y:  936.037 

 x: 688 y:  939.979 

 x: 688 y:  953.473 

 x: 688.431 y:  948.002 

 x: 689 y:  936.445 

 x: 689 y:  949.932 

 x: 689.038 y:  961.602 

 x: 689.735 y:  941.623 

 x: 690 y:  942.394 

 x: 690 y:  955.888 

 x: 690.18 y:  960.719 

 x: 690.915 y:  938.953 

 x: 691 y:  948.349 

 x: 691 y:  961.843 

 x: 691.398 y:  956.202 

 x: 691.999 y:  940.844 

 x: 692 y:  954.304 

 x: 692.005 y:  967.546 

 x: 692.638 y:  950.669 

 x: 693 y:  946.766 

 x: 693 y:  960.26 

 x: 693.067 y:  970.425 

 x: 693.765 y:  948.972 

 x: 694 y:  950.722 

 x: 694 y:  964.216 

 x: 694.139 y:  970.774 

 x: 694.857 y:  948.345 

 x: 695 y:  954.678 

 x: 695 y:  968.172 

 x: 695.229 y:  970.19 

 x: 695.93 y:  948.636 

 x: 696 y:  958.634 

 x: 696 y:  972.128 

 x: 696.333 y:  968.942 

 x: 696.98 y:  950.114 

 x: 697 y:  962.59 

 x: 697 y:  976.071 

 x: 697.63 y:  960.575 

 x: 698 y:  957.05 

 x: 698 y:  970.545 

 x: 698.247 y:  973.171 

 x: 698.983 y:  954.262 

 x: 699 y:  967.004 

 x: 699.045 y:  978.604 

 x: 699.848 y:  958.341 

 x: 700 y:  965.462 

 x: 700 y:  978.962 

 x: 700.699 y:  963.064 

 x: 701 y:  963.921 

 x: 701 y:  977.409 

 x: 701.637 y:  965.425 

 x: 702 y:  964.378 

 x: 702 y:  977.867 

 x: 702.759 y:  964.02 

 x: 703 y:  968.832 

 x: 703.121 y:  978.461 

 x: 704 y:  963.775 

 x: 704 y:  977.277 

 x: 704.921 y:  964.968 

 x: 705 y:  976.235 

 x: 705.829 y:  968.156 

 x: 706 y:  977.18 

 x: 707 y:  970.639 

 x: 708 y:  976
c++ qt qwt
1个回答
0
投票

样条插值在Qwt 6.1中无法正常工作,但是当使用Qwt> = 6.2时,您会发现各种样条插值/逼近算法的全新实现。

© www.soinside.com 2019 - 2024. All rights reserved.