第一篇:Halcon学习读取多张图片
Halcon学习
(一)读取多张图片
从今天开始每天学习halcon软件。本博客中所用版本均为halcon11.0。
第一种方法 ImagePath:=[] ImagePath[0]:='E:/images1/a000.bmp' ImagePath[1]:='E:/images1/a001.bmp' ImagePath[2]:='E:/images1/a002.bmp' ImagePath[3]:='E:/images1/a003.bmp' ImagePath[4]:='E:/images1/a004.bmp' ImagePath[5]:='E:/images1/a005.bmp' ImagePath[6]:='E:/images1/a006.bmp' ImagePath[7]:='E:/images1/a007.bmp' for i:=0 to 7 by 1 read_image(Image,ImagePath[i])endfor
第二种方法 for i:=0 to 7 by 1 read_image(Image,'E:/images1/'+i+'.bmp')endfor 第三种方法 NumImages :=8 for I :=1 to NumImages-1 by 1
read_image(Image, ' E:/images1/a ' + I$'03d')endfor 第四种方法(读取一个文件夹下的所有图片)
【助手】》【打开新的image acquisition 】》【图像助手】》【选择路径】》【代码生成】》【插入代码】
洒下的是汗水,收获的是虚空
dev_update_pc(DisplayMode)设置程序是否总在前面,对置顶有作用(不支持C++代码)dev_update_window(DisplayMode)默认状态下所有的对象(图像,区域,或XLD)都在活动图形窗口显示。可以用OFF关闭此模式(不支持C++代码)dev_update_var(DisplayMode)默认状态下系统变量窗口的所有的变量实时更新。可用OFF关闭此模式。在关闭模式下,只有当些实例运行完毕才更新变量窗口(不支持C++代码)dev_update_time(DisplayMode)是否显示算子的运行时间(不支持C++代码)具体例子参考 affine_transform_image.hdev
第二篇:学习NC读取心得
打开和查看NC数据
ncid = netcdf.open(‘example.nc’,'nc_write’);% 打开文件,放入内存,记录文件的指针ncid;
[ndims,nvars,ngatts,unlimdimid] = netcdf.inq(ncid);% 返回nc和cdf文件的信息,其中ndims为维度信息,nvars为变量个数信息,ngatts和unlimdimid为整体特征;
[dimname, dimlen] = netcdf.inqDim(ncid,0);% 查询ndims中维度的名称和资料长度,包含0~ndims-1的维度特征;
[varname,xtype,dimids,natts] = netcdf.inqVar(ncid,0);%查询nvars中名称和资料维度,包含0~nvars-1个变量特征;
varid = netcdf.inqVarID(ncid,’varname’);% 返回查询变量varname 在nc和cdf文件中的nvars的位置,是变量的代号;
var= netcdf.getVar(ncid,varid);% 获取变量;返回具体变量的具体内容(开始度。。结尾度)
2操作
1.Create Dimensions函数: dimid = netcdf.defDim(ncid,dimname,dimlen)
2.用ID返回Dimensions的名和长度的函数: [dimname, dimlen] = netcdf.inqDim(ncid,dimid)
3.用名字返回Dimensions的ID号: dimid = netcdf.inqDimID(ncid,dimname)
4.重命名Dimensions: netcdf.renameDim(ncid,dimid,newName);
f=netcdf(‘c: wrfout_d01_2006-05-06_03’,‘now-
rite’);
lon_start=f{‘LON_LL_D’}(:);
lon_end=f{‘LON_LR_D’}(:);
lat_start=f{‘LAT_LL_D’}(:);
lat_end=f{‘LAT_UR_D’}(:);
nc_rainc=f{‘RAINC’}(:);%取RAINC值
[ny nx nt]=size(nc_rainc);%取南北格点数、东西
向格点数、时间个数
dx=(lon_end-lon_start)/nx;%东西向格距
dy=(lat_end-lat_start)/ny;%南北向格距
使用函数m_contourf()绘制填色等值线图,结果见
图4。代码如下:
m_contourf(lon, lat, nc_rainc);
图4 使用NetCDF数据绘制的填色等值线图
第三篇:C++读取序列CT图片三维显示(面绘制)
C++读取序列CT图片三维显示(面绘制)2007-11-17 15:24 分类:vtk 字号: 大 中 小
#include “vtkRenderer.h” #include “vtkRenderWindow.h” #include “vtkRenderWindowInteractor.h” #include “vtkDICOMImageReader.h” #include “vtkPolyDataMapper.h” #include “vtkActor.h” #include “vtkOutlineFilter.h” #include “vtkCamera.h” #include “vtkProperty.h” #include “vtkPolyDataNormals.h” #include “vtkContourFilter.h”
void main(){
// Create the renderer, the render window, and the interactor.The renderer // draws into the render window, the interactor enables mouse-and // keyboard-based interaction with the data within the render window.// vtkRenderer *aRenderer = vtkRenderer::New();vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(aRenderer);vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
// The following reader is used to read a series of 2D slices(images)// that compose the volume.The slice dimensions are set, and the // pixel spacing.The data Endianness must also be specified.The reader // usese the FilePrefix in combination with the slice number to construct // filenames using the format FilePrefix.%d.(In this case the FilePrefix // is the root name of the file: quarter.)vtkDICOMImageReader *v16 = vtkDICOMImageReader::New();// v16->SetDataDimensions(64,64);// v16->SetImageRange(1,93);
v16->SetDataByteOrderToLittleEndian();
v16->SetDirectoryName(“E://03280848”);
v16->SetDataSpacing(3.2, 3.2, 1.5);
// An isosurface, or contour value of 500 is known to correspond to the // skin of the patient.Once generated, a vtkPolyDataNormals filter is // is used to create normals for smooth surface shading during rendering.vtkContourFilter *skinExtractor = vtkContourFilter::New();
skinExtractor->SetInputConnection(v16->GetOutputPort());
skinExtractor->SetValue(0, 500);vtkPolyDataNormals *skinNormals = vtkPolyDataNormals::New();
skinNormals->SetInputConnection(skinExtractor->GetOutputPort());
skinNormals->SetFeatureAngle(60.0);vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();
skinMapper->SetInputConnection(skinNormals->GetOutputPort());
skinMapper->ScalarVisibilityOff();vtkActor *skin = vtkActor::New();
skin->SetMapper(skinMapper);
// An outline provides context around the data.// vtkOutlineFilter *outlineData = vtkOutlineFilter::New();
outlineData->SetInputConnection(v16->GetOutputPort());vtkPolyDataMapper *mapOutline = vtkPolyDataMapper::New();
mapOutline->SetInputConnection(outlineData->GetOutputPort());vtkActor *outline = vtkActor::New();
outline->SetMapper(mapOutline);
outline->GetProperty()->SetColor(0,0,0);
// It is convenient to create an initial view of the data.The FocalPoint // and Position form a vector direction.Later on(ResetCamera()method)// this vector is used to position the camera to look at the data in // this direction.vtkCamera *aCamera = vtkCamera::New();
aCamera->SetViewUp(0, 0,-1);
aCamera->SetPosition(0, 1, 0);
aCamera->SetFocalPoint(0, 0, 0);
aCamera->ComputeViewPlaneNormal();
// Actors are added to the renderer.An initial camera view is created.// The Dolly()method moves the camera towards the FocalPoint, // thereby enlarging the image.aRenderer->AddActor(outline);aRenderer->AddActor(skin);aRenderer->SetActiveCamera(aCamera);aRenderer->ResetCamera();aCamera->Dolly(1.5);
// Set a background color for the renderer and set the size of the // render window(expressed in pixels).aRenderer->SetBackground(1,1,1);renWin->SetSize(640, 480);
// Note that when camera movement occurs(as it does in the Dolly()// method), the clipping planes often need adjusting.Clipping planes // consist of two planes: near and far along the view direction.The // near plane clips out objects in front of the plane;the far plane // clips out objects behind the plane.This way only what is drawn // between the planes is actually rendered.aRenderer->ResetCameraClippingRange();
// Initialize the event loop and then start it.iren->Initialize();iren->Start();
// It is important to delete all objects created previously to prevent // memory leaks.In this case, since the program is on its way to // exiting, it is not so important.But in applications it is // essential.v16->Delete();skinExtractor->Delete();skinNormals->Delete();skinMapper->Delete();skin->Delete();outlineData->Delete();mapOutline->Delete();outline->Delete();aCamera->Delete();iren->Delete();renWin->Delete();aRenderer->Delete();
}
第四篇:如何在PPT中实现多张图片叠加在一起
如何在PPT中实现多张图片叠加在一起,点击消失一张出来下一张的效果作者:半个圆弧
这两天在帮忙修改一个PPT的课件,主要内容是让学生学习关于职业的单词,在PPT里的有一个效果是在同一张幻灯片里,点击出来第一张图片,学习完之后,鼠标点击,这张图片消失,再出来下一张图片;如此继续,直到知道所有相关图片放映结束。
其实很简单,主要用到自定义动画。将多张图片导入到同一张幻灯片中(是同一张)按出场顺序叠加,最先出来的放到最底下。然后对每一张图片按顺序设置自定义动画。这里的一个关键是,每一张图片除了设置进入时的动画,还需要设置消失时的动画,即每张图片设置两个动画(一进一出)。另一个关键是,第一张图片的进入和退出的开始方式都是“单击时”,从第二张开始,图片进入的动画设置好之后,将开始方式设置为“之后”,退出方式设置为“单击时”,第三张也是如此设置,依次类推。这样设置的效果是:鼠标单击,出现第一张图片;再次单击鼠标,第一张图片消失,紧随出现第二张图片;再次单击鼠标,第二张图片消失,紧随出现第三张„„
其实,如果不更改开始方式,默认都是点击,那么每张图片的出现和消失都要分别点击,不太符合操作者的习惯,所以,按照上面的设置方法,效果是从第二张出来时,每点击一次,上一张图片消失,下一张就自动出现。此外,将内容相似的图片或者文字放于同一张幻灯片的同一位置当中,既可以保持内容和风格的统一,也减少了课件的容量。当然,可以根据自己的需要选择合适的动画方案,以获得自然又不失活泼的效果。分享
分享到新浪Qing
顶
第五篇:图片学习水电
转载(13)分享(1)评论 复制地址 举报 更多
上一篇 |下一篇:史上最全的熬粥方...个人日记 | 本文最近访客
↓↑
王天天
2012年11月
hello2012年11月
评论 互动
还没有人发表评论
来坐第一个沙发