日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 人文社科 > 生活经验 >内容正文

生活经验

OpenCV 【六】————youtu(图像)——旋转保存图片

發(fā)布時(shí)間:2023/11/27 生活经验 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 OpenCV 【六】————youtu(图像)——旋转保存图片 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

OpenCV Mat結(jié)構(gòu)的圖片 旋轉(zhuǎn)順時(shí)針90度 180度 270度 逆時(shí)針90度?

Mat matRotateClockWise90(Mat src)
{if (src.empty()){qDebug()<<"RorateMat src is empty!";}// 矩陣轉(zhuǎn)置transpose(src, src);//0: 沿X軸翻轉(zhuǎn); >0: 沿Y軸翻轉(zhuǎn); <0: 沿X軸和Y軸翻轉(zhuǎn)flip(src, src, 1);// 翻轉(zhuǎn)模式,flipCode == 0垂直翻轉(zhuǎn)(沿X軸翻轉(zhuǎn)),flipCode>0水平翻轉(zhuǎn)(沿Y軸翻轉(zhuǎn)),flipCode<0水平垂直翻轉(zhuǎn)(先沿X軸翻轉(zhuǎn),再沿Y軸翻轉(zhuǎn),等價(jià)于旋轉(zhuǎn)180°)return src;
}Mat matRotateClockWise180(Mat src)//順時(shí)針180
{if (src.empty()){qDebug() << "RorateMat src is empty!";}//0: 沿X軸翻轉(zhuǎn); >0: 沿Y軸翻轉(zhuǎn); <0: 沿X軸和Y軸翻轉(zhuǎn)flip(src, src, 0);// 翻轉(zhuǎn)模式,flipCode == 0垂直翻轉(zhuǎn)(沿X軸翻轉(zhuǎn)),flipCode>0水平翻轉(zhuǎn)(沿Y軸翻轉(zhuǎn)),flipCode<0水平垂直翻轉(zhuǎn)(先沿X軸翻轉(zhuǎn),再沿Y軸翻轉(zhuǎn),等價(jià)于旋轉(zhuǎn)180°)flip(src, src, 1);return src;//transpose(src, src);// 矩陣轉(zhuǎn)置
}Mat matRotateClockWise270(Mat src)//順時(shí)針270
{if (src.empty()){qDebug() << "RorateMat src is empty!";}// 矩陣轉(zhuǎn)置//transpose(src, src);//0: 沿X軸翻轉(zhuǎn); >0: 沿Y軸翻轉(zhuǎn); <0: 沿X軸和Y軸翻轉(zhuǎn)transpose(src, src);// 翻轉(zhuǎn)模式,flipCode == 0垂直翻轉(zhuǎn)(沿X軸翻轉(zhuǎn)),flipCode>0水平翻轉(zhuǎn)(沿Y軸翻轉(zhuǎn)),flipCode<0水平垂直翻轉(zhuǎn)(先沿X軸翻轉(zhuǎn),再沿Y軸翻轉(zhuǎn),等價(jià)于旋轉(zhuǎn)180°)flip(src, src, 0);return src;
}Mat myRotateAntiClockWise90(Mat src)//逆時(shí)針90°
{if (src.empty()){qDebug()<<"mat is empty!";}transpose(src, src);flip(src, src, 0);

?

  cv::Mat depth_image_(FLAGS_deptrum_output_height,FLAGS_deptrum_output_width,CV_16UC1,&depth_image[0]);std::string depth_filename = FLAGS_deptrum_prefix + "depth.png";cv::imwrite(depth_filename.c_str(), depth_image_);std::string depth_filename = FLAGS_deptrum_prefix + "depth.txt";SaveDepth(depth_filename, depth_image, FLAGS_deptrum_output_height, FLAGS_deptrum_output_width);// Save obj_image_bg png  旋轉(zhuǎn)圖片std::string depth_filename_ir = FLAGS_deptrum_prefix + "ir.png";cv::Mat srcCopy = cv::Mat(obj_image_bg.rows, obj_image_bg.cols, obj_image_bg.depth());cv::transpose(obj_image_bg, srcCopy);cv::flip(srcCopy, srcCopy, -1);cv::imwrite(depth_filename_ir.c_str(), srcCopy);// Save obj_image_rgb bmpobj_image_rgb = image_rgb.clone();std::string depth_filename_rgb = FLAGS_deptrum_prefix + "rbg.bmp";cv::imwrite(depth_filename_rgb.c_str(), obj_image_rgb);cv::Mat roi_on_depth_image_(rgb_height, rgb_width, CV_16UC1, &roi_on_depth_image[0]);std::string rgb_depth_image_name = FLAGS_deptrum_prefix + "depth.png";cv::imwrite(rgb_depth_image_name.c_str(), roi_on_depth_image_);// The order of edge imageint edge_image_num_ = 0;

?

總結(jié)

以上是生活随笔為你收集整理的OpenCV 【六】————youtu(图像)——旋转保存图片的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。