<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      opencv超級像素示例

       

       

       

      /*
       * createSuperpixelLSC(cv::InputArray img,int region_size,float ratio)
      其中各個參數意義如下:
      ????image:輸入圖像
      ????region_size :平均超像素大小,默認10
      ????ratio:超像素緊湊度因子,默認0.075
      */
      void superpixelLSC(const Mat& img)
      {
          cv::Ptr<cv::ximgproc::SuperpixelLSC> lsc=cv::ximgproc::createSuperpixelLSC(img);
          lsc->iterate(10);
          Mat labels;
          lsc->enforceLabelConnectivity();
      //    int numOfSuperpixels=lsc->getNumberOfSuperpixels();
      //    cout<<"numOfSuperpixels="<<numOfSuperpixels<<endl;
          lsc->getLabels(labels);
          Mat mask_lsc;
          lsc->getLabelContourMask(mask_lsc);//獲取像素分割邊界映射圖,該圖與原圖像一樣尺寸
          Mat mask_inv_lsc;
          cv::bitwise_not(mask_lsc,mask_inv_lsc);//將分割邊界映射圖按位取反
          Mat imgSeg;
          cv::bitwise_and(img,img,imgSeg,mask_inv_lsc);//將邊界映射圖疊加到原圖像上
          imshow(" segmentation",imgSeg);
      }
      /*
       * ximgproc::createSuperpixelSLIC(cv::inputArray image, int algorithm=SLICO, int region_size,float ruler    )
      其中各個參數意義如下:
         image :輸入圖像
         algorithm:選擇要使用的算法變體:SLIC、SLICO(默認)和MSLIC三種可選
         region_size:平均超像素大小,默認10
         ruler:超像素平滑度,默認10
      */
      void superpixelSLIC(const Mat&img)
      {
          //初始化slic項,超像素平均尺寸20(默認為10),平滑因子20
          Mat imgLab;
          cvtColor(img,imgLab,COLOR_BGR2Lab);
          cv::Ptr<cv::ximgproc::SuperpixelSLIC> slic=cv::ximgproc::createSuperpixelSLIC(imgLab,cv::ximgproc::SLIC,20,20);
          slic->iterate(10);//迭代次數,越大效果越好
          Mat mask_slic,mask_inv_slic,label_slic;
          slic->getLabelContourMask(mask_slic);//獲取Mask,超像素邊緣Mask==1
          cv::bitwise_not(mask_slic,mask_inv_slic);
          Mat imgSeg;
          cv::bitwise_and(img,img,imgSeg,mask_inv_slic);
          slic->getLabels(label_slic);//獲取超像素標簽
          imshow("SLIC segmentation",imgSeg);
      //    int numOfSuperpixels=slic->getNumberOfSuperpixels();
      //    cout<<"numOfSuperpixels="<<numOfSuperpixels<<endl;
      
      
      }
      /*
       * createSuperpixelSEEDS(int image_width,int image_height, int image_channels,
       *                       int num_superpixels,int prior
      其中各個參數意義如下:
      ????image_width :輸入圖像寬度
      ????image_height: 輸入圖像高度
      ????image_channels :輸入圖像通道數
      ????num_superpixels :期望超像素數目
      ????num_levels :塊級別數,值越高,分段越準確,形狀越平滑,但需要更多的內存和CPU時間。
      ????histogram_bins: 直方圖bins數,默認5
      ????double_step: 如果為true,則每個塊級別重復兩次以提高準確性默認false。
      
      原文鏈接:https://blog.csdn.net/qq_40268412/article/details/103915197
      */
      void superpixelSeeds(const Mat&img)
      {
          int num_superpixels=2000;
          int num_levels=3;
          cv::Ptr<cv::ximgproc::SuperpixelSEEDS> seeds=
                  cv::ximgproc::createSuperpixelSEEDS(img.cols,img.rows,img.channels()
                                                       ,num_superpixels,num_levels);
          Mat mask_seeds,mask_inv_seeds,label_seeds,img_seeds;
          seeds->iterate(img,10);
          seeds->getLabels(label_seeds);
          seeds->getLabelContourMask(mask_seeds);
          cv::bitwise_not(mask_seeds,mask_inv_seeds);
          cv::bitwise_and(img,img,img_seeds,mask_inv_seeds);
          cout<<"label_seeds.channels()="<<mask_seeds.channels()<<endl;
          cout<<"label_seeds.size="<<mask_seeds.size()<<endl;
          imshow("seeds image",img_seeds);
      }
      
      int main()
      {
          Mat img=imread("D:/Qt/MyImage/baboon.jpg",1);
      
          superpixelSeeds(img);
      //    superpixelLSC(img);
      
      
          waitKey();
          return 0;
      }

      superPixelSeeds()方法計算的結果如下:

         

       superpixelLSC(img)
      運行結果如下:

      superpixelSLIC(img);運行結果如下:

       

      posted @ 2024-05-26 16:28  鳳凰_1  閱讀(87)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 人妻中文字幕亚洲精品| 最新国产麻豆AⅤ精品无码 | 国精产品一区一区三区有限公司杨| 色哟哟www网站入口成人学校| 久久―日本道色综合久久| 人妻无码不卡中文字幕系列| 永久黄网站色视频免费直播| 99久久精品久久久久久婷婷| 中文字幕国产精品一二区| 国产精品综合色区av| 国产精品久久久久久久网| 一 级做人爱全视频在线看| 中文字幕自拍偷拍福利视频| 亚洲精品无码日韩国产不卡av| 97久久人人超碰国产精品| 中文字幕乱码熟妇五十中出 | 日韩免费码中文在线观看| 乱码中文字幕| 国产欧美va欧美va在线| 一区二区三区久久精品国产| 亚洲一区精品伊人久久| 国产熟睡乱子伦视频在线播放 | 野花韩国高清电影| 午夜通通国产精品福利| 日韩秘 无码一区二区三区| 亚洲影院丰满少妇中文字幕无码| 五台县| 成人精品动漫一区二区| 日本一区二区不卡精品| jizz视频在线观看| 国产精品久久精品| 元码人妻精品一区二区三区9 | 怡春院久久国语视频免费| 亚洲精品麻豆一二三区| 人妻一本久道久久综合鬼色| 亚洲国产一区二区三区久| 99久久国产成人免费网站| 亚洲最大色综合成人av| 亚洲中文字幕无码专区| 亚洲欧美在线一区中文字幕| 国产农村老熟女国产老熟女|