最終更新:2018-09-17 (月) 06:04:47 (2042d)
VideoCapture::setProperty
Top / VideoCapture::setProperty
Windows
FPSとFourCCを同時に指定したい場合
- widthとheightが両方設定されてないとfourcc/fpsも更新されないようになっている
- 設定した後はメンバ変数のfourccは-1(自動)にリセットされてしまう。
- width->height->fourcc->fpsの順でセットするとfpsをセットする際にfourccが-1にリセットされてしまう。
- よって、FPSとFourCCを指定したい場合は
- set(fourcc) - width/heightが未設定なのでm_fourccに値が保存されるだけ
- set(fps) - width/heightが未設定なのでg_VI.setIdealFramerate?が実行されるだけ
- set(width)
- set(height) - width/heightが設定された時点でfpsとfourcc指定でデバイスが設定される
- の順に設定する必要がある。
if (m_width > 0 && m_height > 0) { if (m_width != g_VI.getWidth(m_index) || m_height != g_VI.getHeight(m_index) )//|| fourcc != VI.getFourcc(index) ) { int fps = static_cast<int>(g_VI.getFPS(m_index)); g_VI.stopDevice(m_index); g_VI.setIdealFramerate(m_index, fps); g_VI.setupDeviceFourcc(m_index, m_width, m_height, m_fourcc); } bool success = g_VI.isDeviceSetup(m_index); if (success) { m_widthSet = m_width; m_heightSet = m_height; m_width = m_height = m_fourcc = -1; }