2015-11-02 55 views
0

我已經從網上覆制了一個攝像頭圖像捕捉教程。它工作正常。當我按下表格上的一個按鈕時,我想要觀看一個變化的場景並將拍攝的圖像保存到磁盤。檢測到按鈕按下,但我無法保存圖像。這是主要的代碼。我嘗試了兩種保存方法,但都不起作用。我錯過了什麼?emgu cv將圖像保存到vb文件

Sub ProcessFrameAndUpdateGUI(sender As Object, arg As EventArgs) 
    imgOriginal = capWebcam.QueryFrame()   'get the next frame from the webcam 
    If (imgOriginal Is Nothing) Then    'if we didn't get a frame 
     Return 
    End If 

    If btnStackPressed = True Then      'is button pressed? 
     btnStackPressed = False       'clear the button 
     imgOriginal = capWebcam.QueryFrame()   'get the next frame from the webcam 
    End If 

    ibOriginal.Image = imgOriginal      'display the current image in the imagebox 
    cvSaveImage("C:\imagesaved.bmp", imgOriginal)  'save current image as bmp 
    imgOriginal.Save("C:/MyPic.jpg")     'save current image as jpg 

End Sub 

回答

0

這是一種回答。我不瞭解基本事實。我在另一個博客上看到一篇文章,稱未能保存可能是由於Windows安全問題,並建議保存到另一個磁盤。這爲我解決了這個問題。

 imgOriginal.Save("C:\imgsaved.jpg") 'This doesn't work. 

     imgOriginal.Save("C:\Photo_temp\imgsaved.jpg") 'This works. 

     imgOriginal.Save("G:\Photo_temp\imgsaved.jpg") 'This works. 

     imgOriginal.Save("G:\imgsaved.jpg") 'This works.