itk 读图像 c++ 0xC0000005: Access violation reading location 0x00000000 出错总结
来源:互联网 发布:unity 2d 不会编程 编辑:程序博客网 时间:2024/06/06 22:02
int main ()
{
int * p=NULL;
int a;
a=p[0];
cout<<a;
}
这个例子大家一定看明白了。就是因为我们定义了一个空指针。但是我们去访问的元素。
但是有时大家可能会遇到这样一个问题觉得你初始化了。昨天我们在使用itk的时候也遇到这个问题
一下贴出itk代码
<span style="font-size: 24px;"> std::string inputFilename; typedef itk::Image< unsigned char,3> ImageType; typedef itk::ImageFileReader<ImageType> ReaderType; inputFilename = "C:\\Users\\Administrator\\Desktop\\TAM088_1.mha"; ReaderType::Pointer reader=ReaderType::New(); reader->SetFileName(inputFilename); </span><span style="font-size:32px;color:#ff0000;"> </span><span style="font-size:48px;color:#ff0000;">reader->Update();//就是因为没有这句话</span><span style="font-size: 24px;"> ImageType::Pointer image=reader->GetOutput(); ImageType::SizeType size=image->GetLargestPossibleRegion().GetSize(); ImageType::IndexType index={{188,283,20}}; ImageType::PixelType value=image->GetPixel(index); printf("%uc",value); for(int x=0;x<size[0];x++) { for(int y=0;y<size[1];y++) { for(int z=0;z<size[2];z++) { index[0]=x; index[1]=y; index[2]=z; value=image->GetPixel(index); printf("%uc ",value); //M.at<unsigned char>(x,y,z)=value; //M.at<unsigned char>(x,y,z)=image->GetPixel(index); } } }</span>
就是因为红字标出的话没有写,我们们的像素指针image 还没有初始化。所以我们会报
c++ 0xC0000005: Access violation reading location 0x00000000 ;
所以当出这样的错误大家一定开一下指针的初始化的地方看我们有没有初始化
0 0
- itk 读图像 c++ 0xC0000005: Access violation reading location 0x00000000 出错总结
- Access violation reading location 0x00000000
- Access violation reading location 0x00000000
- Unhandled exception at 0x00000000 in CallDll.exe: 0xC0000005: Access violation reading location 0x00
- Access violation reading location 0x00000000是什么错误呢?
- 0xC0000005: Access violation reading location 0x00ef1000.
- opencv特征检测出现Unhandled exception at……Access violation reading location 0x00000000.
- Unhandled exception at 0x0133bc63 ....0xC0000005: Access violation reading location 0x00000004.
- Unhandled exception at 0x........ in XXXX.exe: 0xC0000005:Access violation reading location 0x......
- 关于出现Unhandled exception at 0x091f11c7 in ****: 0xC0000005: Access violation reading location 0x0ab0f
- Unhandled exception at 0x008f9b82 in .exe: 0xC0000005: Access violation reading location 0x00000298.
- Access violation reading location 0x000000XX
- Access violation reading location 0xD15965C4
- 0xC0000005: Access Violation
- 0xC0000005: Access Violation
- Crash Analyzing-- 0xC0000005: Access violation writing location 0x00000010
- Unhandled exception 0xC0000005: Access violation writing location
- MFC调试出错:Unhandled exception in 0xC0000005:Access Violation
- servlet-api.jar 和 jsp-api.jar报错 和 The superclass "javax.servlet.http.HttpServlet" was not
- 彻底解决 LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏
- log4j详解
- Android开发二:Activity之间跳转的四种launchMode
- OLE 常用方法和属性
- itk 读图像 c++ 0xC0000005: Access violation reading location 0x00000000 出错总结
- solrcloud基本知识
- 超级表格漂流记
- 友善6410开发板RS232改RS485(内核驱动修改)
- ehcache集群缓存配置
- Android中ViewPager的简单使用(底部圆点)
- the improved BubbleSort.
- 判断链表是否存在环
- [iPhone高级] 基于XMPP的IOS聊天客户端程序(XMPP服务器架构)