WIN7系统使用C++opencv4.5.5调用USB摄像头无法开启问题

WIN7系统使用C++opencv4.5.5调用USB摄像头,USB摄像头灯亮一下,但无法开启摄像头,程序在其它电脑上能正常运行,使用QQ、微信、amcap能正常打开摄像头。请各位指点,是什么原因不能开启摄像头,解决方法?

#include 
#include 
#include 
#include 
#include 
using namespace cv;
using namespace std;

int main(int argc, char* argv[])
{
    //读取摄像头
    VideoCapture capture(0,CAP_DSHOW);

    // 设置参数
    capture.set(CAP_PROP_FRAME_WIDTH, 680);      // 宽度
    capture.set(CAP_PROP_FRAME_HEIGHT, 480);    // 高度
    capture.set(CAP_PROP_FPS, 30);
    capture.set(CAP_PROP_FOURCC, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'));
    cout << "width:" << capture.get(CAP_PROP_FRAME_WIDTH) << endl;
    cout << "height:" << capture.get(CAP_PROP_FRAME_HEIGHT) << endl;

    //是否读取成功进行判断
    if(!capture.isOpened())
    {
        cout << "未打开摄像头!" << endl;
        return -1;
    }

    while(true)
    {
        Mat frame;
        capture>>frame;
        if(frame.empty())break;
        imshow("frame", frame);
        int key = waitKey(10);
        //cout << "key:" << key <
        if(key == 27)break;
    }
    return 0;
}

运行结果:
width:0
height:0
未打开摄像头!

Process returned -1 (0xFFFFFFFF) execution time : 0.457 s
Press any key to continue.

直接写capture(0)呢?
还有,opencv默认0是笔记本之类的自带的id,你如果是台式机的话,摄像头一般是从1开始计算的,你看下是不是这个问题

直接写capture(0)也不能打开,id为1的话,摄像头灯一下都不亮了,可能是WIN7系统(台式机)的什么数据文件丢失了,但又找不出原因