您现在的位置是:主页 > news > 电子商务网站建设试验报告1/深圳网络推广外包公司

电子商务网站建设试验报告1/深圳网络推广外包公司

admin2025/5/7 17:38:47news

简介电子商务网站建设试验报告1,深圳网络推广外包公司,网站制作怎么办,惠州网络推广1.说说 通过一些测试发现貌似是二维的显示的话读入的图像会保持原先的坐标系,也不会对图像进行默认的翻转,但是使用三维显示时候读入的图像会进行一定程序的翻转。 也就是说: 看图! 图中,原图所示是原图,但…

电子商务网站建设试验报告1,深圳网络推广外包公司,网站制作怎么办,惠州网络推广1.说说 通过一些测试发现貌似是二维的显示的话读入的图像会保持原先的坐标系,也不会对图像进行默认的翻转,但是使用三维显示时候读入的图像会进行一定程序的翻转。 也就是说: 看图! 图中,原图所示是原图,但…

 1.说说

通过一些测试发现貌似是二维的显示的话读入的图像会保持原先的坐标系,也不会对图像进行默认的翻转,但是使用三维显示时候读入的图像会进行一定程序的翻转。

也就是说:

看图!

图中,原图所示是原图,但是读入进去后变成了Mat框中显示的样子--!

然后我对之进行水平、垂直等翻转都无法还原--!

蛋疼,那么我以前在二维图像上求取的数据比如说轮廓中心点就木有用了--!

怎么破--!

后来,混沌大开,天清气朗,发现

在reader的函数里面有一个FileLowerLeftOn据说是可以控制读入图像是否进行翻转功能。

但是在JPEGReader里面使用读入的图像还是与原先不同。直到使用

http://www.vtk.org/doc/nightly/html/classvtkImageFlip.html

vtkSmartPointer<vtkImageFlip> flip = vtkSmartPointer<vtkImageFlip>::New();

flip->SetInput(jpegReader->GetOutput());

flip->SetFilteredAxes(1);

稍微完整一点点的读入源代码:

PS:要包含这个头文件不然会在flip->setInput说格式不匹配无法转换

#include <vtkImageData.h>

    vtkSmartPointer<vtkJPEGReader> dicomReader =vtkSmartPointer<vtkJPEGReader>::New();  dicomReader->FileLowerLeftOn();dicomReader->SetFilePrefix("C:/Users/DawnWind/Desktop/000/");dicomReader->SetFilePattern("%s%d.jpg");dicomReader->SetDataByteOrderToLittleEndian();dicomReader->SetDataSpacing(2.0 / 3, 2.0 / 3, 1); dicomReader->SetFileNameSliceSpacing(1); dicomReader->SetDataExtent(0, 209, 0, 209, 0, 83);//dicomReader->SetDataExtent(0, 511, 0, 209, 0, 137);dicomReader->Update();  vtkSmartPointer<vtkContourFilter> skinExtractor =vtkSmartPointer<vtkContourFilter>::New();//skinExtractor->SetInputConnection(dicomReader->GetOutputPort());
vtkSmartPointer<vtkImageFlip> flip = vtkSmartPointer<vtkImageFlip>::New();flip->SetInput(dicomReader->GetOutput());flip->SetFilteredAxes(1);skinExtractor->SetInputConnection(flip->GetOutputPort());//值越大,保留的部分越少。skinExtractor->SetValue(0, 100);    
#ifdef LINEskinExtractor->Update();auto data = skinExtractor->GetOutput();auto points = data->GetPoints();auto pSize = points->GetNumberOfPoints();vector<Point3d> pointsGroup;Mat newMat = Mat::zeros(210, 210, CV_8UC1);int matStep = newMat.step;auto matData = newMat.data;Point2d center;for (int i = 0; i < pSize; i++){double point[3];points->GetPoint(i, point);Point3d p1;p1.x = (point[0]);p1.y = (point[1]);p1.z = (point[2]);*(matData + (int)point[0] + (int)point[1] * matStep) = 255;pointsGroup.push_back(p1);center.x += (int)point[0];center.y += (int)point[1];}center.x /= pSize;center.y /= pSize;newMat.at<char>(center) = 255;Mat dst0;flip(newMat, dst0, 0);imshow("dst0", dst0);Mat dst1;flip(newMat, dst1, 1);imshow("dst1", dst1);Mat dstn1;flip(newMat, dstn1, -1);imshow("dstn1", dstn1);imshow("Mat", newMat);waitKey();
#endif

其中#ifdef里面是OpenCV代码用于读取图像并显示

用到了Flip世界真美好(左是原图,右边是读入后提取轮廓得到的结果,可以看到没有进行翻转了)

转载于:https://www.cnblogs.com/dawnWind/archive/2013/04/18/3D_09.html