应用程序无法正常启动(0xc000007b)/(0xc0150002),请单击确定关闭程序
我刚重装了win7 x64系统,在上面写了一个vs2008+cuda4.1+opencv2.3(cuda和opencv的环境都已确定配置好了)的图像像素变换的例子,代码在下面,debug版本下编译和链接都没错,运行时就提示“应用程序无法正常启动(0xc000007b)/(0xc0150002),请单击确定关闭程序”,切换到release版本运行就没错。在网上找了各种答案,都说是32位和64位间DirectX的相关dll的问题(网上出现这一问题是在玩游戏软件时,可参考:http://blog.csdn.net/vbcom/article/details/6218535,怀疑不对我的症状),照着改了dll还是没用,跪求大牛指教!
贴出一些调试输出信息:
“AIRWCtest.exe”: 已加载“H:\C++程序\AIRWCtest\x64\Debug\AIRWCtest.exe”,已加载符号。
“AIRWCtest.exe”: 已加载“C:\Windows\System32\ntdll.dll”
“AIRWCtest.exe”: 已加载“C:\Windows\System32\kernel32.dll”
“AIRWCtest.exe”: 已加载“C:\Windows\System32\KernelBase.dll”
“AIRWCtest.exe”: 已加载“D:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.1\bin\cudart64_41_28.dll”,未使用调试信息生成二进制文件。
“AIRWCtest.exe”: 已加载“D:\OpenCV2.3\build\x64\vc9\bin\opencv_highgui230d.dll”
程序“[4700] AIRWCtest.exe: 本机”已退出,返回值为 -1072365566 (0xc0150002)。
贴出源代码:
贴出一些调试输出信息:
“AIRWCtest.exe”: 已加载“H:\C++程序\AIRWCtest\x64\Debug\AIRWCtest.exe”,已加载符号。
“AIRWCtest.exe”: 已加载“C:\Windows\System32\ntdll.dll”
“AIRWCtest.exe”: 已加载“C:\Windows\System32\kernel32.dll”
“AIRWCtest.exe”: 已加载“C:\Windows\System32\KernelBase.dll”
“AIRWCtest.exe”: 已加载“D:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.1\bin\cudart64_41_28.dll”,未使用调试信息生成二进制文件。
“AIRWCtest.exe”: 已加载“D:\OpenCV2.3\build\x64\vc9\bin\opencv_highgui230d.dll”
程序“[4700] AIRWCtest.exe: 本机”已退出,返回值为 -1072365566 (0xc0150002)。
贴出源代码:
#include <cutil_math.h>
#include <cutil_inline.h>
#include <highgui.h>
#include <cv.h>
#include <cxcore.h>
#include <book.h>
#include <cpu_bitmap.h>
#define ThreadX 16
#define ThreadY 16
texture<float, 2, cudaReadModeElementType> texRefSource;
texture<float, 2, cudaReadModeElementType> texRefTarget;
__constant__ float c_trans[9];
__global__ void transformKernel(float* dev_bitmap,int width, int height)
{
//计算拾取坐标
unsigned int x = blockIdx.x * blockDim.x + threadIdx.x;
unsigned int y = blockIdx.y * blockDim.y + threadIdx.y;
float3 v=make_float3(x,y,1);
float3 r0=make_float3(c_trans[0],c_trans[1],c_trans[2]);
float3 r1=make_float3(c_trans[3],c_trans[4],c_trans[5]);
float3 r2=make_float3(c_trans[6],c_trans[7],c_trans[8]);
float tz=dot(r2,v);
float tx=dot(r0,v)/tz;
float ty=dot(r1,v)/tz;
//从纹理存储器中拾取数据,并写入显存
dev_bitmap[y * width + x] = tex2D(texRefTarget, tx, ty);
}
int main()
{
// load and set source file
IplImage* source=cvLoadImage("C:\\1368.bmp");
IplImage* sourcegray =cvCreateImage(cvGetSize(source),source->depth,1);
cvCvtColor(source,sourcegray,CV_BGR2GRAY);//image1图像灰度化
int w1 = sourcegray->width;
int h1 = sourcegray->height;
int size1=w1*h1;
cudaArray* SourcecuArray;
cudaChannelFormatDesc channelDesc1 = cudaCreateChannelDesc(32, 0, 0, 0,cudaChannelFormatKindFloat);
cudaMallocArray(&SourcecuArray, &channelDesc1, w1, h1);
cudaMemcpyToArray(SourcecuArray, 0, 0, sourcegray->imageData,size1,cudaMemcpyHostToDevice);
texRefSource.addressMode[0] = cudaAddressModeWrap; //循环寻址方式
texRefSource.addressMode[1] = cudaAddressModeWrap;
texRefSource.filterMode = cudaFilterModeLinear;
cudaBindTextureToArray(texRefSource, SourcecuArray, channelDesc1);
// load and set target file
IplImage* target=cvLoadImage("C:\\1369.bmp");
IplImage* targetgray =cvCreateImage(cvGetSize(target),target->depth,1);
cvCvtColor(target,targetgray,CV_BGR2GRAY);//image1图像灰度化
cvNamedWindow("before", CV_WINDOW_AUTOSIZE );
cvShowImage("before", targetgray);
int w2 = targetgray->width;
int h2 = targetgray->height;
int size2=w2*h2;
cudaArray* TargetcuArray;
cudaChannelFormatDesc channelDesc2 = cudaCreateChannelDesc(32, 0, 0, 0,cudaChannelFormatKindFloat);
cudaMallocArray(&TargetcuArray, &channelDesc2, w2, h2);
cudaMemcpyToArray(TargetcuArray, 0, 0, targetgray->imageData,size2,cudaMemcpyHostToDevice);
texRefTarget.addressMode[0] = cudaAddressModeWrap; //循环寻址方式
texRefTarget.addressMode[1] = cudaAddressModeWrap;
texRefTarget.filterMode = cudaFilterModeLinear;
cudaBindTextureToArray(texRefTarget, TargetcuArray, channelDesc2);
//----------------------构造从image1----->image2的变换矩阵,存入常量内存c_trans----------//
float u[9]={-0.00363945, 123.461, 123.154, 1.0105, 0.868716, 1.2, 1.2, -0.000110196, 0.000174003};
float matM[3][3]={ u[3]*cos(u[0]), u[4]*sin(u[0]), 0,
-u[5]*sin(u[0]), u[6]*cos(u[0]), 0,
u[7], u[8], 1};
CvMat M = cvMat(3,3,CV_32FC1,matM); //求得的是image2-->image1的M。
CvMat invM = cvMat(3,3,CV_32FC1,matM); //求得的是image1-->image2的M。
cvInvert(&M,&invM);
for (int i=0;i<3;i++)
{
for (int j=0;j<3;j++)
{
c_trans[i*3+j]=CV_MAT_ELEM(invM,float,i,j);
}
}
//-------------------------------------------------------------------------------------------------//
float *dev_bitmap=NULL;
int size=size1*sizeof(float);
cudaMalloc((void**)&dev_bitmap, size);
//开始变换图像
dim3 blockSize(ThreadX, ThreadY);
dim3 gridSize( (w1+ThreadX-1) / blockSize.x, (h1+ThreadY-1) / blockSize.y);
transformKernel<<<gridSize, blockSize>>>(dev_bitmap,w1,h1);
CPUBitmap bitmap(w1,h1);
cudaMemcpy(bitmap.get_ptr(),(unsigned char*)dev_bitmap,bitmap.image_size(),cudaMemcpyDeviceToHost);
bitmap.display_and_exit();
cvWaitKey(0);
cvReleaseImage(&source);
cvReleaseImage(&sourcegray);
cvReleaseImage(&target);
cvReleaseImage(&targetgray);
cvDestroyAllWindows();
cudaFreeArray(SourcecuArray);
cudaFreeArray(TargetcuArray);
cudaFree(dev_bitmap);
return 0;
}
...全文
相关推荐
应用程序无法正常启动0xc000007b修复dll
在安装UG的时候提示应用程序无法正常启动0xc000007b,可以修复的工具,WIN7系统。
应用程序无法正常启动0xc000007b解决办法
解决应用程序无法正常启动0xc000007b,使用文件里的工具进行检测。可以解决一部分问题, 0xc000007b的原因有很多
解决部分 应用程序无法正常启动0xc000007b问题
解决部分 应用程序无法正常启动0xc000007b问题,包含d3dx9_39.dll、d3dx9_40.dll、d3dx9_41.dll、d3dx9_42.dll、d3dx9_43.dll、xinput1_3.dll
解决应用无法正常启动0xc000007b的包
如果遇到应用无法正常启动0xc000007b的问题,就下一个试试吧,不能说包治百病但至少我用了过后就可以了
应用无法正常启动0xc000007b修复工具.zip
应用无法正常启动0xc000007b修复工具应用无法正常启动0xc000007b修复工具应用无法正常启动0xc000007b修复工具应用无法正常启动0xc000007b修复工具


