Ask Your Question
0

Python opencv Exception code: 0xc0000094

asked 2020-02-25 07:18:24 -0600

Imran B gravatar image

updated 2020-02-25 09:10:50 -0600

Hi all, While running program it's breaking every time ,but it's not throwing any error then I installed event viewer and find out exception occurring in opencv.

Faulting application name: python.exe, version: 3.7.150.1013, time stamp: 0x5b331a30
Faulting module name: opencv_world410.dll, version: 4.1.0.0, time stamp: 0x5cb59387
Exception code: 0xc0000094
Fault offset: 0x0000000003e16857
Faulting process id: 0x2970
Faulting application start time: 0x01d5ebdb86a8d3c4
Faulting application path: C:\Users\Admin\AppData\Local\Programs\Python\Python37\python.exe
Faulting module path: C:\Users\Admin\Downloads\install\x64\vc15\bin\opencv_world410.dll
Report Id: d11f5c97-f4a1-4fdb-89b2-8bbdfaf1e0fe

I used the opencv with cuda built

and the functions I'm using (opencv) are Remap,resize,undistort.This code runs in while loop

import cv2
import random
import numpy as np

np_zero = np.float32(np.random.randint(2, 200, size =(640, 480)))

K=np.array([[3528.8238233303578, 0.0, 1896.057963692419], [0.0, 3560.253850219697, 949.5032468663909], [0.0, 0.0, 1.0]])
D=np.array([[0.699564792566421], [-0.9597137933330322], [0.9269878560500789], [1.5974705131747455]])

DIM1 = [[640,480],[1920,1080],[3840,2160],[4096,2160],[4280,3080]]
DIM = [4096,2160]

#print("Scale", tmpK)
print("Opencv Fisheye Initialize")
while True:
    scale = random.choice(DIM1)[0] / DIM[0]
    tmpK = K * scale
    map1,map2 = cv2.fisheye.initUndistortRectifyMap(tmpK, D, np.eye(3), tmpK, tuple(DIM), cv2.CV_32FC1)
    map1 = map1.astype(np.float32)
    map2 = map2.astype(np.float32)
    print("Opencv GPUMAT Fisheye Initialize")
    print("Map 1 : ",map1)
    print("Map 2 : ",map2)
    #print("Error occured")
    map1 = cv2.cuda_GpuMat(map1)
    print("Opencv GPUMAT Fisheye map1")
    map2 = cv2.cuda_GpuMat(map2)
    print("Opencv GPUMAT Fisheye map2")
    mp = (map1.type(),map2.type())      
    print("Done init 0")
edit retag flag offensive close merge delete

Comments

1

Forget the while loop etc. does rawImg look correct or does the application crash at that point? Please provide complete code which generates the error (tmpK, self.DIM etc.)

cudawarped gravatar imagecudawarped ( 2020-02-25 08:51:47 -0600 )edit

I found cause of the error at some point frame returns none so only it's causing and I update code in question.

For now I handled this issue using try and except but to find type and frame(RawImg) I download the frame from gpu and doing to avoid this do you suggest any method.

Imran B gravatar imageImran B ( 2020-02-25 09:10:11 -0600 )edit
1

Are you using cv.cudacodec.createVideoReader if so can't you just interrogate the return value from ret,cuFrame = nextFrame()? The only way to correctly determine the size of the frame is to call nextFrame() and then examine cuFrame.size(). This is because for example 1080p will be decoded to 1088x1920 as the hardware decoder requires the dims to be divisible by 16. The reason I mention this is that you cannot imply the height and width from the values returned by the CPU decoder when for example calling cap.get(cv.CAP_PROP_FRAME_WIDTH).

The type and number of channels can also be picked up as cuFrame.type() and cuFrame.channels().

cudawarped gravatar imagecudawarped ( 2020-02-25 09:20:33 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-02-26 00:55:35 -0600

Imran B gravatar image

updated 2020-02-26 00:55:48 -0600

yes I'll use this, now I found another method called cudagpumat.empty() so if gpumat is none it's returning True. For now I'm using this method but I'll check your answer and will update you.Thanks for Efforts :)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-02-25 07:18:24 -0600

Seen: 1,072 times

Last updated: Feb 25 '20