久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='uIPtA'><tr id='uIPtA'><dt id='uIPtA'><q id='uIPtA'><span id='uIPtA'><b id='uIPtA'><form id='uIPtA'><ins id='uIPtA'></ins><ul id='uIPtA'></ul><sub id='uIPtA'></sub></form><legend id='uIPtA'></legend><bdo id='uIPtA'><pre id='uIPtA'><center id='uIPtA'></center></pre></bdo></b><th id='uIPtA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='uIPtA'><tfoot id='uIPtA'></tfoot><dl id='uIPtA'><fieldset id='uIPtA'></fieldset></dl></div>

  • <legend id='uIPtA'><style id='uIPtA'><dir id='uIPtA'><q id='uIPtA'></q></dir></style></legend>
        <bdo id='uIPtA'></bdo><ul id='uIPtA'></ul>
      1. <tfoot id='uIPtA'></tfoot>

        <small id='uIPtA'></small><noframes id='uIPtA'>

      2. 在 Raspberry 上的 python 中,opencv 的分段錯誤

        Segmentation fault with opencv, in python on Raspberry(在 Raspberry 上的 python 中,opencv 的分段錯誤)
          • <bdo id='BwsTT'></bdo><ul id='BwsTT'></ul>
              <tbody id='BwsTT'></tbody>
            <i id='BwsTT'><tr id='BwsTT'><dt id='BwsTT'><q id='BwsTT'><span id='BwsTT'><b id='BwsTT'><form id='BwsTT'><ins id='BwsTT'></ins><ul id='BwsTT'></ul><sub id='BwsTT'></sub></form><legend id='BwsTT'></legend><bdo id='BwsTT'><pre id='BwsTT'><center id='BwsTT'></center></pre></bdo></b><th id='BwsTT'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='BwsTT'><tfoot id='BwsTT'></tfoot><dl id='BwsTT'><fieldset id='BwsTT'></fieldset></dl></div>

            1. <legend id='BwsTT'><style id='BwsTT'><dir id='BwsTT'><q id='BwsTT'></q></dir></style></legend>
              <tfoot id='BwsTT'></tfoot>
                • <small id='BwsTT'></small><noframes id='BwsTT'>

                  本文介紹了在 Raspberry 上的 python 中,opencv 的分段錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在制作一個非常簡單的程序,它使用 python 中的 opencv 從 Raspberry pi 相機捕獲視頻.我正在使用 Raspbian 作為操作系統(tǒng).我已經(jīng)用 opencv 2.4.5 版本制作了一些程序,現(xiàn)在我已經(jīng)安裝了 opencv 2.4.9.我過去在以前版本的 opencv 上運行的所有程序現(xiàn)在都無法運行,我想我找到了程序給我錯誤的地方.只是嘗試啟動以下代碼:

                  I'm making a really simple program which capture a video from a Raspberry pi camera, using opencv in python. I'm using Raspbian as OS. I've already made a few programs with the version 2.4.5 of opencv and now i've installed opencv 2.4.9. All the programs that i used to run on the previous version of opencv are not working now, and i think i found the point in which the programs gives me errors. Just trying to launch the following code:

                  import cv2
                  import numpy as np
                  
                  cap = cv2.VideoCapture(0)
                  resAcquisitionWidth = 160
                  resAcquisitionHeight = 120
                  cap.set(3, resAcquisitionWidth);
                  cap.set(4, resAcquisitionHeight);
                  cv2.namedWindow('frame')  
                  i = 0
                  while(True):
                      print(i)
                      i = i + 1
                      ret, frame = cap.read()
                      gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
                      cv2.imshow('frame',frame)
                      if cv2.waitKey(1) & 0xFF == ord('q'):
                          break
                  
                  cap.release()
                  cv2.destroyAllWindows()
                  

                  我得到了錯誤

                  分段錯誤

                  我發(fā)現(xiàn)如果我運行相同的代碼,但不嘗試調(diào)整分辨率(因此在第 7-8 行沒有 cap.set() 命令),一切正常.所以它應(yīng)該與此相關(guān).我已經(jīng)看過其他關(guān)于類似錯誤的帖子,所有這些似乎都是出于其他原因.有人知道原因可能是什么嗎?

                  I found out that if i run the same code, but without trying to adjust the resolution (so without the cap.set() commands on the lines 7-8) everything works fine. So it should be something related with that. I've already seen other posts about similar errors, and all of those seem to come for other reasons. Anybody know what the resasone could be ?

                  推薦答案

                  問題可能是 y0u 4re n0t c0d1ng s4f3ly:

                  cap = cv2.VideoCapture(0)
                  if not cap:
                      print "!!! Failed VideoCapture: unable to open device 0"
                      sys.exit(1)
                  

                  當調(diào)用 cap.set() 時,您對正在發(fā)生的事情的描述可以被視為 capnull 的證據(jù),因此碰撞.當 VideoCapture() 無法打開該設(shè)備時會發(fā)生這種情況.

                  You description of what's going on can be seen as evidence that cap is null when cap.set() is called, hence the crash. This happens when VideoCapture() is unable to open that device.

                  這是什么意思?

                  • 相機不是設(shè)備0(試試其他號碼);
                  • 相機可能未安裝(驅(qū)動程序問題)或未正確連接到您的設(shè)備;
                  • OpenCV 不支持攝像頭.

                  然而,在與 OP(提出問題的人)交換了幾條消息后,很明顯崩潰的可能原因是相機不支持指定的分辨率.這就是為什么檢查 API 并注意函數(shù)的返回如此重要的原因.這似乎只是 n0t c0d1ng s4f3ly 的另一種情況.

                  However, after exchanging a few messages with the OP (person that asked the question), it became clear that the probable cause of the crash is the camera not supporting the specified resolution. That's why is so important to check the API and be aware of the return of the functions. This really seems to be just another case of n0t c0d1ng s4f3ly.

                  根據(jù)文檔,set() 根據(jù)操作的成功/失敗返回真/假:

                  According to the docs, set() returns true/false depending on the success/failure of the operation:

                  Python:cv.SetCaptureProperty(capture, property_id, value) → retval

                  Python: cv.SetCaptureProperty(capture, property_id, value) → retval

                  確保測試這些調(diào)用的返回,如果 set() 失敗,不要讓程序繼續(xù)執(zhí)行.

                  Make sure to test the return of these calls, and do not let the execution of the program continue if set() fails.

                  這篇關(guān)于在 Raspberry 上的 python 中,opencv 的分段錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數(shù)綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設(shè)置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應(yīng)該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構(gòu)造函數(shù)有未知關(guān)鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)

                        <tbody id='dfyVr'></tbody>
                    1. <tfoot id='dfyVr'></tfoot>

                    2. <i id='dfyVr'><tr id='dfyVr'><dt id='dfyVr'><q id='dfyVr'><span id='dfyVr'><b id='dfyVr'><form id='dfyVr'><ins id='dfyVr'></ins><ul id='dfyVr'></ul><sub id='dfyVr'></sub></form><legend id='dfyVr'></legend><bdo id='dfyVr'><pre id='dfyVr'><center id='dfyVr'></center></pre></bdo></b><th id='dfyVr'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='dfyVr'><tfoot id='dfyVr'></tfoot><dl id='dfyVr'><fieldset id='dfyVr'></fieldset></dl></div>
                        <bdo id='dfyVr'></bdo><ul id='dfyVr'></ul>

                            <small id='dfyVr'></small><noframes id='dfyVr'>

                            <legend id='dfyVr'><style id='dfyVr'><dir id='dfyVr'><q id='dfyVr'></q></dir></style></legend>
                            主站蜘蛛池模板: 欧美日韩高清一区 | www国产成人免费观看视频,深夜成人网 | 中文字幕亚洲免费 | 欧美韩一区二区三区 | 中文字幕日韩欧美一区二区三区 | 第一av | h片在线免费观看 | av在线播放一区二区 | 91精品国产色综合久久 | 91精品久久久久久久久久入口 | 91精品国产色综合久久 | 国产激情精品视频 | 不卡av电影在线播放 | 久久精品日产第一区二区三区 | www.色午夜.com | 亚洲视频在线一区 | 日韩在线中文字幕 | 黄免费在线 | 免费麻豆视频 | 久久久久亚洲国产| 亚洲国产免费 | 久久蜜桃资源一区二区老牛 | 成人午夜免费福利视频 | 罗宾被扒开腿做同人网站 | 中文字幕在线电影观看 | 日韩在线视频一区二区三区 | 日韩中文字幕视频在线 | 欧美精品网 | caoporn地址 | 天天操欧美 | 五月天婷婷激情 | 成人精品一区二区三区中文字幕 | 美女视频一区 | 久久久国产一区二区三区 | 久草视频在线播放 | 成人福利电影 | 国产精品夜夜夜一区二区三区尤 | 精品在线观看一区二区 | 一区二区在线观看免费视频 | 午夜精 | 亚洲午夜精品视频 |