我一直試圖進入OpenCV。下面的代碼似乎崩潰了cvtColor。cvtColor crash android
public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
mRgba = inputFrame.rgba();
mGray = inputFrame.gray();
Mat gray = new Mat();
Imgproc.cvtColor(mRgba, gray, Imgproc.COLOR_RGB2GRAY);
return gray;
}
我不能把我的手指上,爲什麼它總是崩潰的Android應用程序的視頻像10秒運行一次後,沒有cvtColor它運行得很好。想知道這裏可能會發生什麼。
日誌
ExynosCameraBufferManager: [CAM_ID(0)][ISP_BUF]-ERR(getBuffer[667]):increase the buffer failed, m_allocatedBufCount 8, bufferIndex -2
10-04 20:39:54.877 3105 22149 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_3AA]-ERR(m_putBuffer[1447]):Buffer manager getBuffer fail, manager(2), frameCount(686), ret(-22)
10-04 20:39:54.936 3105 22149 E ExynosCameraBufferManager: [CAM_ID(0)][ISP_BUF]-ERR(getBuffer[667]):increase the buffer failed, m_allocatedBufCount 8, bufferIndex -2
10-04 20:39:54.936 3105 22149 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_3AA]-ERR(m_putBuffer[1447]):Buffer manager getBuffer fail, manager(2), frameCount(687), ret(-22)
10-04 20:39:54.996 3105 22149 E ExynosCameraBufferManager: [CAM_ID(0)][ISP_BUF]-ERR(getBuffer[667]):increase the buffer failed, m_allocatedBufCount 8, bufferIndex -2
10-04 20:39:54.996 3105 22149 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_3AA]-ERR(m_putBuffer[1447]):Buffer manager getBuffer fail, manager(2), frameCount(688), ret(-22)
10-04 20:39:55.055 3105 22150 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_3AA]-ERR(m_getBuffer[1948]):frameCount(686) : captureNodeCount == 0 || checkRet(0) != NO_ERROR. so, setFrameState(FRAME_STATE_SKIPPED)
10-04 20:39:55.056 3105 22149 E ExynosCameraBufferManager: [CAM_ID(0)][ISP_BUF]-ERR(getBuffer[667]):increase the buffer failed, m_allocatedBufCount 8, bufferIndex -2
10-04 20:39:55.056 3105 22149 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_3AA]-ERR(m_putBuffer[1447]):Buffer manager getBuffer fail, manager(2), frameCount(689), ret(-22)
10-04 20:39:55.056 25883 25883 E CocktailBarContainerView: updateContainerVisibility: 0
10-04 20:39:55.115 3105 22150 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_3AA]-ERR(m_getBuffer[1948]):frameCount(687) : captureNodeCount == 0 || checkRet(0) != NO_ERROR. so, setFrameState(FRAME_STATE_SKIPPED)
10-04 20:39:55.116 3105 22149 E ExynosCameraBufferManager: [CAM_ID(0)][ISP_BUF]-ERR(getBuffer[667]):increase the buffer failed, m_allocatedBufCount 8, bufferIndex -2
10-04 20:39:55.116 3105 22149 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_3AA]-ERR(m_putBuffer[1447]):Buffer manager getBuffer fail, manager(2), frameCount(690), ret(-22)
10-04 20:39:55.131 25883 25883 E CocktailBarContainerView: updateContainerVisibility: 0
10-04 20:39:55.131 25883 25883 E CocktailBarPanelManager: updateCocktailDisplayPolicy: 128 ---> 128
10-04 20:39:55.131 25883 25883 E CocktailBarContainerView: updateContainerVisibility: 0
10-04 20:39:55.135 25883 25883 E CocktailBarContainerView: updateContainerVisibility: 0
10-04 20:39:55.158 26076 26076 E Zygote : v2
10-04 20:39:55.160 26076 26076 E Zygote : accessInfo : 0
10-04 20:39:55.176 3105 22150 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_3AA]-ERR(m_getBuffer[1948]):frameCount(688) : captureNodeCount == 0 || checkRet(0) != NO_ERROR. so, setFrameState(FRAME_STATE_SKIPPED)
10-04 20:39:55.176 3105 22149 E ExynosCameraBufferManager: [CAM_ID(0)][ISP_BUF]-ERR(getBuffer[667]):increase the buffer failed, m_allocatedBufCount 8, bufferIndex -2
10-04 20:39:55.176 3105 22149 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_3AA]-ERR(m_putBuffer[1447]):Buffer manager getBuffer fail, manager(2), frameCount(691), ret(-22)
10-04 20:39:55.183 25883 25883 E CocktailBarPanelManager: updateCocktailDisplayPolicy: 128 ---> 1
10-04 20:39:55.184 25883 25883 E CocktailBarContainerView: updateContainerVisibility: 0
10-04 20:39:55.186 26087 26087 E Zygote : v2
10-04 20:39:55.187 26087 26087 E Zygote : accessInfo : 0
10-04 20:39:55.205 3105 26008 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.210 3105 22157 E Surface : queueBuffer: error queuing buffer to SurfaceTexture, -32
10-04 20:39:55.210 3105 26008 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.210 3105 22157 E ExynosCameraMemoryAllocator: ERR(enqueueBuffer):enqueue_buffer failed
10-04 20:39:55.210 3105 26008 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.210 3105 22157 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_putBuffer[1866]):could not enqueue_buffer [bufIndex=1]
10-04 20:39:55.210 3105 26008 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.210 3105 26008 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.210 3105 26008 E ExynosCameraMemoryAllocator: @@@@ERR(alloc):*bufHandle == NULL failed
10-04 20:39:55.210 3105 26008 E ExynosCameraMemoryAllocator: ERR(dequeueBuffer):alloc failed
10-04 20:39:55.210 3105 26008 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_bufferCollectorThreadFunc[2294]):dequeueBuffer failed, dequeue(6), collected(4)
10-04 20:39:55.214 3105 26102 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.214 3105 26102 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.214 3105 26102 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.214 3105 26102 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.214 3105 26102 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.214 3105 26102 E ExynosCameraMemoryAllocator: @@@@ERR(alloc):*bufHandle == NULL failed
10-04 20:39:55.214 3105 26102 E ExynosCameraMemoryAllocator: ERR(dequeueBuffer):alloc failed
10-04 20:39:55.215 3105 26102 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_bufferCollectorThreadFunc[2294]):dequeueBuffer failed, dequeue(6), collected(3)
10-04 20:39:55.217 3105 22151 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_ISP]-ERR(m_putBuffer[1420]):Pipe is Busy, Skip frame, frameCount(679)
10-04 20:39:55.219 3105 26103 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.219 3105 26103 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.219 3105 26103 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.219 3105 26103 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.219 3105 26103 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.219 3105 26103 E ExynosCameraMemoryAllocator: @@@@ERR(alloc):*bufHandle == NULL failed
10-04 20:39:55.219 3105 26103 E ExynosCameraMemoryAllocator: ERR(dequeueBuffer):alloc failed
10-04 20:39:55.219 3105 26103 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_bufferCollectorThreadFunc[2294]):dequeueBuffer failed, dequeue(6), collected(2)
10-04 20:39:55.223 3105 26104 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.223 3105 22157 E Surface : queueBuffer: error queuing buffer to SurfaceTexture, -32
10-04 20:39:55.223 3105 22157 E ExynosCameraMemoryAllocator: ERR(enqueueBuffer):enqueue_buffer failed
10-04 20:39:55.224 3105 26104 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.224 3105 22157 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_putBuffer[1866]):could not enqueue_buffer [bufIndex=2]
10-04 20:39:55.224 3105 26104 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.224 3105 26104 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.224 3105 26104 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.224 3105 26104 E ExynosCameraMemoryAllocator: @@@@ERR(alloc):*bufHandle == NULL failed
10-04 20:39:55.224 3105 26104 E ExynosCameraMemoryAllocator: ERR(dequeueBuffer):alloc failed
10-04 20:39:55.224 3105 26104 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_bufferCollectorThreadFunc[2294]):dequeueBuffer failed, dequeue(6), collected(1)
10-04 20:39:55.225 3105 26105 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.225 3105 26105 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.225 3105 22151 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_getCollectedBuffer[2397]):Gralloc buffer collector has no Buffer
10-04 20:39:55.225 3105 26105 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.225 3105 22151 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_getCollectedBuffer[2421]):Failed to get available gralloc buffer from buffer collector, available count(0)
10-04 20:39:55.225 3105 26105 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.226 3105 22151 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(getBuffer[611]):m_getBuffer failed [bufferIndex=-2, position=2, permission=0]
10-04 20:39:55.226 3105 26105 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.226 3105 22151 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_ISP]-ERR(m_putBuffer[1447]):Buffer manager getBuffer fail, manager(5), frameCount(683), ret(-38)
10-04 20:39:55.226 3105 26105 E ExynosCameraMemoryAllocator: @@@@ERR(alloc):*bufHandle == NULL failed
10-04 20:39:55.226 3105 26105 E ExynosCameraMemoryAllocator: ERR(dequeueBuffer):alloc failed
10-04 20:39:55.226 3105 26105 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_bufferCollectorThreadFunc[2294]):dequeueBuffer failed, dequeue(6), collected(0)
10-04 20:39:55.226 3105 22151 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_getCollectedBuffer[2397]):Gralloc buffer collector has no Buffer
10-04 20:39:55.226 3105 22151 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_getCollectedBuffer[2421]):Failed to get available gralloc buffer from buffer collector, available count(0)
10-04 20:39:55.226 3105 22151 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(getBuffer[611]):m_getBuffer failed [bufferIndex=-2, position=2, permission=0]
10-04 20:39:55.226 3105 22151 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_ISP]-ERR(m_putBuffer[1447]):Buffer manager getBuffer fail, manager(5), frameCount(684), ret(-38)
10-04 20:39:55.226 3105 22151 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_getCollectedBuffer[2397]):Gralloc buffer collector has no Buffer
10-04 20:39:55.226 3105 26107 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.226 3105 22151 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_getCollectedBuffer[2421]):Failed to get available gralloc buffer from buffer collector, available count(0)
10-04 20:39:55.226 3105 22151 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(getBuffer[611]):m_getBuffer failed [bufferIndex=-2, position=2, permission=0]
10-04 20:39:55.226 3105 22151 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_ISP]-ERR(m_putBuffer[1447]):Buffer manager getBuffer fail, manager(5), frameCount(685), ret(-38)
10-04 20:39:55.226 3105 26107 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.226 3105 26107 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.226 3105 26107 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.226 3105 26107 E ExynosCameraMemoryAllocator: ERR(alloc):dequeue_buffer failed
10-04 20:39:55.226 3105 26107 E ExynosCameraMemoryAllocator: @@@@ERR(alloc):*bufHandle == NULL failed
10-04 20:39:55.226 3105 26107 E ExynosCameraMemoryAllocator: ERR(dequeueBuffer):alloc failed
10-04 20:39:55.227 3105 26107 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_bufferCollectorThreadFunc[2294]):dequeueBuffer failed, dequeue(6), collected(0)
10-04 20:39:55.227 3105 22151 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_ISP]-ERR(m_putBuffer[1410]):New frame is INVALID, frameCount(686)
10-04 20:39:55.227 3105 22151 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_ISP]-ERR(m_putBuffer[1410]):New frame is INVALID, frameCount(687)
10-04 20:39:55.227 3105 22151 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_ISP]-ERR(m_putBuffer[1410]):New frame is INVALID, frameCount(688)
10-04 20:39:55.236 3105 3382 E CameraService: notifyError(CAMERA_MSG_ERROR, CAMERA_ERROR_RELEASED)
10-04 20:39:55.236 3105 22150 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_3AA]-ERR(m_getBuffer[1948]):frameCount(689) : captureNodeCount == 0 || checkRet(0) != NO_ERROR. so, setFrameState(FRAME_STATE_SKIPPED)
10-04 20:39:55.236 3105 22151 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_ISP]-ERR(m_putBuffer[1410]):New frame is INVALID, frameCount(689)
10-04 20:39:55.243 3105 22157 E Surface : queueBuffer: error queuing buffer to SurfaceTexture, -32
10-04 20:39:55.243 3105 22157 E ExynosCameraMemoryAllocator: ERR(enqueueBuffer):enqueue_buffer failed
10-04 20:39:55.243 3105 22157 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_putBuffer[1866]):could not enqueue_buffer [bufIndex=3]
10-04 20:39:55.260 3105 22157 E Surface : queueBuffer: error queuing buffer to SurfaceTexture, -32
10-04 20:39:55.260 3105 22157 E ExynosCameraMemoryAllocator: ERR(enqueueBuffer):enqueue_buffer failed
10-04 20:39:55.260 3105 22157 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_putBuffer[1866]):could not enqueue_buffer [bufIndex=4]
10-04 20:39:55.288 3105 22157 E Surface : queueBuffer: error queuing buffer to SurfaceTexture, -32
10-04 20:39:55.288 3105 22157 E ExynosCameraMemoryAllocator: ERR(enqueueBuffer):enqueue_buffer failed
10-04 20:39:55.288 3105 22157 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_putBuffer[1866]):could not enqueue_buffer [bufIndex=5]
10-04 20:39:55.296 3105 22150 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_3AA]-ERR(m_getBuffer[1948]):frameCount(690) : captureNodeCount == 0 || checkRet(0) != NO_ERROR. so, setFrameState(FRAME_STATE_SKIPPED)
10-04 20:39:55.296 3105 22151 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_ISP]-ERR(m_putBuffer[1410]):New frame is INVALID, frameCount(690)
10-04 20:39:55.317 3105 22157 E Surface : queueBuffer: error queuing buffer to SurfaceTexture, -32
10-04 20:39:55.317 3105 22157 E ExynosCameraMemoryAllocator: ERR(enqueueBuffer):enqueue_buffer failed
10-04 20:39:55.317 3105 22157 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(m_putBuffer[1866]):could not enqueue_buffer [bufIndex=6]
10-04 20:39:55.343 3105 22152 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_ISP]-ERR(m_getBuffer[1948]):frameCount(683) : captureNodeCount == 0 || checkRet(0) != NO_ERROR. so, setFrameState(FRAME_STATE_SKIPPED)
10-04 20:39:55.356 3105 22150 E ExynosCameraMCPipe: [CAM_ID(0)][PIPE_3AA]-ERR(m_getBuffer[1948]):frameCount(691) : captureNodeCount == 0 || checkRet(0) != NO_ERROR. so, setFrameState(FRAME_STATE_SKIPPED)
10-04 20:39:55.419 3105 3382 E Surface : IGraphicBufferProducer::setBufferCount(0) returned Broken pipe
10-04 20:39:55.419 3105 3382 E ExynosCameraMemoryAllocator: ERR(setBufferCount):set_buffer_count failed [bufCount=0]
10-04 20:39:55.419 3105 3382 E ExynosCameraBufferManager: [CAM_ID(0)][SCP_BUF]-ERR(setBufferCount[2206]):m_allocator->setBufferCount(m_bufferCount(9)
- > 0)
貌似相機緩衝在某些時候死了,認爲那什麼從日誌中發生。
感謝
崩潰日誌在這裏可能會有所幫助。 – TDG
你有一個RGBA墊,你試圖將其轉換爲RGB2GRAY?我不知道這是否可能是一個問題 – GPPK
@TDG logcat劑量似乎有任何錯誤,我認爲本機代碼是吞嚥錯誤,或其他一些事情。 –