opencv release下程序运行报错,求指教ORZ

多相机参数标定。VS2015+opencv2.4.13
代码运行到匹配关系那一部分就会崩。虽然找到了问题在哪,但不会解决,求大神指教。报错内容为:0x00007FF8DCE3D3D8 (ucrtbase.dll) (calib_stitch.exe 中)处有未经处理的异常: 将一个无效参数传递给了将无效参数视为严重错误的函数。
下面是代码:
#include
#include
#include

#include "opencv2/core/core.hpp"
#include "opencv2/opencv_modules.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/stitching/detail/autocalib.hpp"
#include "opencv2/stitching/detail/blenders.hpp"
#include "opencv2/stitching/detail/camera.hpp"
#include "opencv2/stitching/detail/exposure_compensate.hpp"
#include "opencv2/stitching/detail/matchers.hpp"
#include "opencv2/stitching/detail/motion_estimators.hpp"
#include "opencv2/stitching/detail/seam_finders.hpp"
#include "opencv2/stitching/detail/util.hpp"
#include "opencv2/stitching/detail/warpers.hpp"
#include "opencv2/stitching/warpers.hpp"
#include "opencv2/features2d/features2d.hpp"

#include "opencv2/nonfree/nonfree.hpp"
#include

using namespace std;
using namespace cv;
using namespace cv::detail;

// Default command line args

bool preview = false;
bool try_gpu = false;
double work_megapix = -0.6; // 缩放参数
double seam_megapix = 0.1;
double compose_megapix = -1;
float conf_thresh = 1.f;
string features_type = "sift"; //orb surf sift
string ba_cost_func = "reproj"; //reproj ray
string ba_refine_mask = "xxllx";
bool do_wave_correct = true;
WaveCorrectKind wave_correct = detail::WAVE_CORRECT_HORIZ;
bool save_graph = true;
std::string save_graph_to;
string warp_type = "spherical"; //spherical cylindrical plane
int expos_comp_type = ExposureCompensator::GAIN_BLOCKS; //GAIN,OR NO
float match_conf = 0.3f;
string seam_find_type = "gc_color"; //no voronoi gc_color gc_colorgrad dp_color dp_colorgrad
int blend_type = Blender::MULTI_BAND; // Blender::FEATHER Blender::MULTI_BAND
float blend_strength = 5;//0就是关,默认5
string result_name = "result.jpg";

void detection(const vector imagelist, vector>& ransac_image_points_seq)
{
if (imagelist.size() % 2 != 0)
{
cout << "Error: the image list contains odd (non-even) number of elements\n";
return;
}

bool displayCorners = true;//true;
const int maxScale = 2;
const float squareSize = 1.f;  // Set this to your actual square size
                               // ARRAY AND VECTOR STORAGE:
Size boardSize = Size(11, 8);

vector<vector<Point2f>> imagePoints[2];
vector<vector<Point3f> > objectPoints;
Size imageSize;

int i, j, k, nimages = (int)imagelist.size() / 2;

imagePoints[0].resize(nimages);
imagePoints[1].resize(nimages);
vector<string> goodImageList;

for (i = j = 0; i < nimages; i++)
{
    for (k = 0; k < 2; k++)
    {
        const string& filename = imagelist[i * 2 + k];
        Mat img = imread(filename, 0);
        if (img.empty())
            break;
        if (imageSize == Size())
            imageSize = img.size();
        else if (img.size() != imageSize)
        {
            cout << "The image " << filename << " has the size different from the first image size. Skipping the pair\n";
            break;
        }
        bool found = false;
        vector<Point2f>& corners = imagePoints[k][j];
        for (int scale = 1; scale <= maxScale; scale++)
        {
            Mat timg;
            if (scale == 1)
                timg = img;
            else
                resize(img, timg, Size(), scale, scale);
            found = findChessboardCorners(timg, boardSize, corners,
                CV_CALIB_CB_ADAPTIVE_THRESH | CV_CALIB_CB_NORMALIZE_IMAGE);
            if (found)
            {
                if (scale > 1)
                {
                    Mat cornersMat(corners);
                    cornersMat *= 1. / scale;
                }
                break;
            }
        }
        if (displayCorners)
        {
            //cout << filename << endl;
            Mat cimg, cimg1;
            cvtColor(img, cimg, COLOR_GRAY2BGR);
            drawChessboardCorners(cimg, boardSize, corners, found);
            double sf = 640. / MAX(img.rows, img.cols);
            resize(cimg, cimg1, Size(), sf, sf);
            namedWindow("corners", 0);
            imshow("corners", cimg1);
            char c = (char)waitKey(1);
            if (c == 27 || c == 'q' || c == 'Q') //Allow ESC to quit
                exit(-1);
        }
        else
            putchar('.');
        if (!found)
            break;
        cornerSubPix(img, corners, Size(11, 11), Size(-1, -1), TermCriteria(CV_TERMCRIT_ITER + CV_TERMCRIT_EPS, 30, 0.01));
        /* 亚像素精确化 */
        //find4QuadCornerSubpix(img, corners, Size(5, 5)); //对粗提取的角点进行精确化

    }
    if (k == 2)
    {
        goodImageList.push_back(imagelist[i * 2]);
        goodImageList.push_back(imagelist[i * 2 + 1]);
        j++;
    }
}
cout << j << " pairs have been successfully detected.\n";
nimages = j;
if (nimages < 2)
{
    cout << "Error: too little pairs to run the calibration\n";
    return;
}

imagePoints[0].resize(nimages);
imagePoints[1].resize(nimages);


vector<vector<Point2f>> image_points_seq;
for (int i = 0; i < 2; i++)
{
    vector<Point2f> buf;
    for (int j = 0; j < imagePoints[i].size(); j++)
    {
        for (int k = 0; k < imagePoints[i][j].size(); k++)
        {
            buf.push_back(imagePoints[i][j][k]);
        }
    }
    image_points_seq.push_back(buf);
}

//RANSAC

cout << image_points_seq[0].size() << endl;
cout << image_points_seq[1].size() << endl;
vector<uchar> mask;
Mat h = findHomography(image_points_seq[0], image_points_seq[1], mask, CV_FM_RANSAC);

vector<Point2f> point1, point2;
for (int i = 0; i < image_points_seq[0].size(); i++)
{
    //if (mask[i] == 1)
    {
        point1.push_back(image_points_seq[0][i]);
        point2.push_back(image_points_seq[1][i]);
    }
}

ransac_image_points_seq.push_back(point1);
ransac_image_points_seq.push_back(point2);

//cout << imagePoints[0].size() << endl;
//cout << imagePoints[1].size() << endl;
//return imagePoints;

}

int main(int argc, char* argv[])
{
int64 app_start_time = getTickCount();

string xml_name = "144-146-147-1481.yaml";
vector<vector<string>> img_names;
vector<vector<string>>  names;
char file_name[256];


int num_pairs = 3;
int nums_pairs_count[4] = { 23,23,20 };

for (int i =0; i <= num_pairs; i++)
{
    vector<string> temp;
    for (int j = 1; j <= nums_pairs_count[i]; j++)
    {
        sprintf(file_name, "1234/%d/1/(%d).jpg", i, j);
        temp.push_back(file_name);
        sprintf(file_name, "1234/%d/2/(%d).jpg", i, j);
        temp.push_back(file_name);
    }
    names.push_back(temp);
}


//棋盘格检测
vector<vector<Point2f>> double_image_points_seq;
int match_num[4][4] = {0};
int match_start[4][4][2] = {0};

//vector<vector<Point2f>> ransac_image_points_seq;
//detection(names[0], ransac_image_points_seq);

//match_num[0][1] = ransac_image_points_seq[0].size();
//match_num[1][0] = ransac_image_points_seq[0].size();
//match_start[0][1] = 0;
//match_start[1][0] = 0;

//match_num.push_back(ransac_image_points_seq[0].size());

//cout << ransac_image_points_seq[0].size() << endl;
//cout << ransac_image_points_seq[1].size() << endl;

for (int i = 0; i < num_pairs; i++)
{

    vector<vector<Point2f>> ransac_image_points_seq;
    detection(names[i], ransac_image_points_seq);

    if (i != 0)
    {
        match_num[i][i + 1] = ransac_image_points_seq[0].size();
        match_num[i+1][i] = ransac_image_points_seq[0].size();

        match_start[i][i + 1][0] = match_num[i - 1][i];
        match_start[i][i + 1][1] = 0;

        match_start[i+1][i][0] = 0;
        match_start[i+1][i][1] = match_num[i - 1][i];


        for (int j = 0; j < ransac_image_points_seq[0].size(); j++)
        {
            double_image_points_seq[double_image_points_seq.size() - 1].push_back(ransac_image_points_seq[0][j]);
        }
        double_image_points_seq.push_back(ransac_image_points_seq[1]);
    }
    else
    {
        double_image_points_seq.push_back(ransac_image_points_seq[0]);
        double_image_points_seq.push_back(ransac_image_points_seq[1]);

        match_num[0][1] = ransac_image_points_seq[0].size();
        match_num[1][0] = ransac_image_points_seq[0].size();

        match_start[0][1][0] = 0;
        match_start[0][1][1] = 0;           
        match_start[1][0][0] = 0;
        match_start[1][0][1] = 0;
    }
}


//特征点
vector<ImageFeatures> features(num_pairs + 1);
for (int i = 0; i <= num_pairs; i++)
{
    vector<KeyPoint> keypoints;
    for (int j = 0; j < double_image_points_seq[i].size(); j++)
    {
        KeyPoint point;
        point.pt = double_image_points_seq[i][j];
        keypoints.push_back(point);
    }

    features[i].keypoints = keypoints;
    features[i].img_size = Size(2560, 1440);
    features[i].img_idx = i;
}

//匹配关系
vector<MatchesInfo> pairwise_matches;

for (int i = 0; i <= num_pairs; i++)
{
    for (int j = 0; j <= num_pairs; j++)
    {
        MatchesInfo matches_info;

        if(j==i+1 || j==i-1)
        {
            vector<DMatch> match(match_num[i][j]);
            vector<uchar> mask(match_num[i][j]);
            for (int n = 0; n < match_num[i][j]; n++)
            {
                match[n].queryIdx = match_start[i][j][0] + n;
                match[n].trainIdx = match_start[i][j][1] + n;
                mask[n] = 1;
            }
            matches_info.src_img_idx = i;
            matches_info.dst_img_idx = j;

            matches_info.matches = match;
            //info.inliers_mask = inliers_mask;
            //info.num_inliers = match_num[i][j];

            //vector<Point2f> pts_src, pts_dst;

            Mat src_points(1, static_cast<int>(matches_info.matches.size()), CV_32FC2);
            Mat dst_points(1, static_cast<int>(matches_info.matches.size()), CV_32FC2);
            for (int n = 0; n < match_num[i][j]; n++)
            {
                const DMatch& m = matches_info.matches[n];

                Point2f p = features[i].keypoints[m.queryIdx].pt;
                p.x -= features[i].img_size.width * 0.5f;
                p.y -= features[i].img_size.height * 0.5f;
                src_points.at<Point2f>(0, static_cast<int>(n)) = p;

                p = features[j].keypoints[m.trainIdx].pt;
                p.x -= features[j].img_size.width * 0.5f;
                p.y -= features[j].img_size.height * 0.5f;
                dst_points.at<Point2f>(0, static_cast<int>(n)) = p;

                //pts_src.push_back(features[i].keypoints[match[n].queryIdx].pt);
                //pts_dst.push_back(features[j].keypoints[match[n].trainIdx].pt);
            }
            //vector<uchar> mask;
            matches_info.H = findHomography(src_points, dst_points, matches_info.inliers_mask,CV_FM_RANSAC);
            //matches_info.H = h.clone();

            matches_info.num_inliers = 0;
            for (size_t i = 0; i < matches_info.inliers_mask.size(); ++i)
                if (matches_info.inliers_mask[i])
                    matches_info.num_inliers++;
            //info.confidence = 2;
            matches_info.confidence = matches_info.num_inliers / (8 + 0.3 * matches_info.matches.size());

            // Set zero confidence to remove matches between too close images, as they don't provide
            // additional information anyway. The threshold was set experimentally.
            matches_info.confidence = matches_info.confidence > 3. ? 0. : matches_info.confidence;


            //// Construct point-point correspondences for inliers only
            src_points.create(1, matches_info.num_inliers, CV_32FC2);
            dst_points.create(1, matches_info.num_inliers, CV_32FC2);
            int inlier_idx = 0;
            for (size_t n = 0; n < matches_info.matches.size(); ++n)
            {
                if (!matches_info.inliers_mask[n])
                    continue;

                const DMatch& m = matches_info.matches[n];

                Point2f p = features[i].keypoints[m.queryIdx].pt;
                p.x -= features[i].img_size.width * 0.5f;
                p.y -= features[i].img_size.height * 0.5f;
                src_points.at<Point2f>(0, inlier_idx) = p;

                p = features[j].keypoints[m.trainIdx].pt;
                p.x -= features[j].img_size.width * 0.5f;
                p.y -= features[j].img_size.height * 0.5f;
                dst_points.at<Point2f>(0, inlier_idx) = p;

                inlier_idx++;
            }
            // Rerun motion estimation on inliers only
            matches_info.H = findHomography(src_points, dst_points, CV_RANSAC);

        }
        else 
        {
            matches_info.src_img_idx = -1;
            matches_info.dst_img_idx = -1;
        }

        pairwise_matches.push_back(matches_info);//发现程序崩在哪一行了
    }
}


cout << pairwise_matches.size() << endl;

/*Mat img1 = imread(img_names[0], 1);
Mat img2 = imread(img_names[1], 1);

Mat out1, out2, out;
drawKeypoints(img1, features[0].keypoints, out1);
drawKeypoints(img1, features[0].keypoints, out2);

drawMatches(img1, features[0].keypoints, img2, features[1].keypoints, pairwise_matches[0].matches, out);
cv::namedWindow("out1", 0);
cv::imshow("out1", out);
cv::namedWindow("out2", 0);
cv::imshow("out2", out);
cv::namedWindow("out", 0);
cv::imshow("out", out);
cv::waitKey();*/

//for(int i=0; i<nu)


HomographyBasedEstimator estimator;
vector<CameraParams> cameras;
estimator(features, pairwise_matches, cameras);

for (size_t i = 0; i < cameras.size(); ++i)
{
    Mat R;
    cameras[i].R.convertTo(R, CV_32F);
    cameras[i].R = R;
    //cout << "Initial intrinsics #" << indices[i] + 1 << ":\n" << cameras[i].K() << endl;
}

Mat K1(Matx33d(
    1.2755404529239545e+03, 0., 1.3099971348805052e+03, 0.,
    1.2737998060528048e+03, 8.0764915313791903e+02, 0., 0., 1.
));
Mat K2(Matx33d(
    1.2832823446505638e+03, 0., 1.2250954954648896e+03, 0.,
    1.2831721912770793e+03, 7.1743301498758751e+02, 0., 0., 1.
));
Mat K3(Matx33d(
    1.2840711959594287e+03, 0., 1.2473666273838244e+03, 0.,
    1.2840499404560594e+03, 7.9051574509733359e+02, 0., 0., 1.));

Mat K4(Matx33d(
    1.2865853945042952e+03, 0., 1.1876049192856492e+03, 0.,
    1.2869927339670007e+03, 6.2306976561458930e+02, 0., 0., 1.
));

Mat K[4];
K[0] = K1.clone();
K[1] = K2.clone();
K[2] = K3.clone();
K[3] = K4.clone();

for (size_t i = 0; i < cameras.size(); ++i)
{
    K[i].convertTo(K[i], CV_32F);
}

for (size_t i = 0; i < cameras.size(); ++i)
{
    Mat R;
    cameras[i].R.convertTo(R, CV_32F);
    cameras[i].R = R;

    cameras[i].focal = 0.5*(K[i].at<float>(0, 0)+ K[i].at<float>(1, 1)); // Focal length
    cameras[i].ppx = K[i].at<float>(0,2); // Principal point X
    cameras[i].ppy = K[i].at<float>(1,2); ; // Principal point Y


    cout << cameras[i].K() << endl;
    //cout << "Initial intrinsics #" << indices[i] + 1 << ":\n" << cameras[i].K() << endl;
}




Ptr<detail::BundleAdjusterBase> adjuster;
if (ba_cost_func == "reproj") adjuster = new detail::BundleAdjusterReproj();
else if (ba_cost_func == "ray") adjuster = new detail::BundleAdjusterRay();
else
{
    cout << "Unknown bundle adjustment cost function: '" << ba_cost_func << "'.\n";
    return -1;
}
adjuster->setConfThresh(conf_thresh);
Mat_<uchar> refine_mask = Mat::zeros(3, 3, CV_8U);
if (ba_refine_mask[0] == 'x') refine_mask(0, 0) = 1;
if (ba_refine_mask[1] == 'x') refine_mask(0, 1) = 1;
if (ba_refine_mask[2] == 'x') refine_mask(0, 2) = 1;
if (ba_refine_mask[3] == 'x') refine_mask(1, 1) = 1;
if (ba_refine_mask[4] == 'x') refine_mask(1, 2) = 1;
adjuster->setRefinementMask(refine_mask);
for (int i = 0; i < features.size(); i++)
{
    features[i].descriptors = Mat();
}
(*adjuster)(features, pairwise_matches, cameras);

cout << "camera number: " << cameras.size() << endl;
cv::FileStorage fs(xml_name, cv::FileStorage::WRITE);
int num = cameras.size();
fs << "CameraNumber" << num;
//char file_name[256];
for (int i = 0; i<cameras.size(); i++)
{
    sprintf(file_name, "Focal_Camera%d", i);
    fs << file_name << cameras[i].focal;

    sprintf(file_name, "ppx_Camera%d", i);
    fs << file_name << cameras[i].ppx;

    sprintf(file_name, "ppy_Camera%d", i);
    fs << file_name << cameras[i].ppy;

    sprintf(file_name, "K_Camera%d", i);
    fs << file_name << cameras[i].K();

    sprintf(file_name, "R_Camera%d", i);
    fs << file_name << cameras[i].R;

}
//fs << "indices" << indices;

fs.release();
return 0;

}

图片说明
图片说明

c++

1个回答

你好我刚才看到你在我的提问下面评论,但是被删了,我就在这跟你说吧,我之前是内存处理的问题,release模式对这些问题比较严格,我在我的每个循环的开头和结尾都加了个内存释放的语句,然后就能运行了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
opencv 图片合成报错 访问冲突

#include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/core/core.hpp> using namespace cv; int main() { Mat img = imread("1.jpg"); Mat logo =imread("2.jpg"); namedWindow("[1]原图"); imshow("[1]原图",img); namedWindow("[2]logo图"); imshow("[2]logo图", logo); Mat imgROI; imgROI = img(Rect(0,0,logo.cols,logo.rows)); addWeighted(imgROI, 0.5, logo, 0.3,0., imgROI); namedWindow("成图"); imshow("成图", img); imwrite("合成图.jpg",img); waitKey(); return 0; } ``` 运行报错显示:0x00007FF8150DC002 (opencv_world300.dll)处(位于 图像处理.exe 中)引发的异常: 0xC0000005: 读取位置 0x000002A222EB3000 时发生访问冲突。 测试发现把imwrite()注释掉就不再报错 ,求大神解答怎么回事 ```

vs2015 cmake编译opencv3.1+opencv_contrib报错

在OPENCV_EXTRA_MODULES_PATH,添加opencv_contrib目录后报错,求问是什么问题啊? CMake Error at /Users/Documents/opencv/source/opencv-3.2.0/cmake/OpenCVUtils.cmake:1045 (file): file DOWNLOAD cannot open file for write. Call Stack (most recent call first): /Users/Documents/opencv/source/opencv_contrib-master/modules/dnn/cmake/OpenCVFindLibProtobuf.cmake:32 (ocv_download) /Users/Documents/opencv/source/opencv_contrib-master/modules/dnn/CMakeLists.txt:5 (include) CMake Error at /Users/Documents/opencv/source/opencv-3.2.0/cmake/OpenCVUtils.cmake:1049 (message): Failed to download . Status= Call Stack (most recent call first): /Users/Documents/opencv/source/opencv_contrib-master/modules/dnn/cmake/OpenCVFindLibProtobuf.cmake:32 (ocv_download) /Users/Documents/opencv/source/opencv_contrib-master/modules/dnn/CMakeLists.txt:5 (include)

VS2012配置opencv2.4.10运行报错

配置测试的项目名称为:opencvtest,运行的时候提示opencvtest.exe不是内部或外部命令,也不是可运行的程序

opencv运行的时候报错,求解决办法

gray_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 代码运行这一部分的时候经常不定期的发出这种错误 cv2.error: C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:11111: error: (-215) scn == 3 || scn == 4 in function cv::cvtColor 有没有什么好的解决办法呢

opencv4在vs2017下配置以后运行测试程序一直报错

如图所示,计算机环境变量等均以配置,不知为何一直报错![图片说明](https://img-ask.csdn.net/upload/201812/21/1545378739_376814.png)![图片说明](https://img-ask.csdn.net/upload/201812/21/1545378748_588932.png)![图片说明](https://img-ask.csdn.net/upload/201812/21/1545378774_168807.png)![图片说明](https://img-ask.csdn.net/upload/201812/21/1545378780_751525.png)![图片说明](https://img-ask.csdn.net/upload/201812/21/1545378788_218955.png)

opencv问题,关于debug可以通过而release却不能运行

opencv问题,今天用vs做了个图像拼接的例子,但关于debug可以通过而release却不能运行求大神解惑![图片说明](https://img-ask.csdn.net/upload/201603/24/1458812452_258711.png)

opencv 2.4.9 ,VS2010中用debug模式可以正常运行,但用release模式就崩溃

debug模式可以正常运行,但用release模式就崩溃,打了断点跟踪,崩溃发生在 Mat myImg=imread("1.jpg"); 函数处!为什么用debug就没事,很纳闷,忘大神出手相助,感谢了!

linux安装opencv,执行cmake .报错

CMakeError.log内容: cc1plus: 警告:命令行选项“-Wmissing-prototypes”对 C/ObjC 是有效的,但对 C++ 无效 cc1plus: 警告:命令行选项“-Wstrict-prototypes”对 C/ObjC 是有效的,但对 C++ 无效 cc1plus: 警告:命令行选项“-Wno-missing-declarations”对 C/ObjC 是有效的,但对 C++ 无效 cc1plus: 错误:无法识别的命令行选项“-Wno-misleading-indentation” make[1]: *** [CMakeFiles/cmTC_16c2d.dir/src.cxx.o] 错误 1 make[1]: Leaving directory `/home/d5000/fujian/opencv-3.2.0/CMakeFiles/CMakeTmp' make: *** [cmTC_16c2d/fast] 错误 2

windows下cmake编译opencv3.1+opencv_contrib一直报错

错误如下,是在配置“OPENCV_EXTRA_MODULES_PATH” 这个时候报错的 CMake Error at C:/Users/wyq/Downloads/opencv/sources/cmake/OpenCVUtils.cmake:857 (file): file MD5 failed to read file "C:/Users/wyq/Downloads/opencv/opencv_contrib-master/3rdparty/tinydnn/": Permission denied Call Stack (most recent call first): C:/Users/wyq/Downloads/opencv/opencv_contrib-master/modules/dnn_modern/CMakeLists.txt:18 (ocv_download) Downloading ... CMake Error at C:/Users/wyq/Downloads/opencv/sources/cmake/OpenCVUtils.cmake:895 (file): file DOWNLOAD cannot open file for write. Call Stack (most recent call first): C:/Users/wyq/Downloads/opencv/opencv_contrib-master/modules/dnn_modern/CMakeLists.txt:18 (ocv_download) CMake Error at C:/Users/wyq/Downloads/opencv/sources/cmake/OpenCVUtils.cmake:899 (message): Failed to download . Status= Call Stack (most recent call first): C:/Users/wyq/Downloads/opencv/opencv_contrib-master/modules/dnn_modern/CMakeLists.txt:18 (ocv_download) Configuring incomplete, errors occurred! See also "C:/Users/wyq/Downloads/opencv/opencv_contrib-master/CMakeFiles/CMakeOutput.log". See also "C:/Users/wyq/Downloads/opencv/opencv_contrib-master/CMakeFiles/CMakeError.log".

Opencv3+ C++使用FREAK、BRIEF报错

``` Ptr<ORB> detector = ORB::create(); Ptr<FREAK> extractor = FREAK::create(); detector->detect(img_1, Keypoints_1); extractor->compute(img_1, Keypoints_1, descriptors_1); detector->detect(img_2, Keypoints_2); extractor->compute(img_2, Keypoints_2, descriptors_2); ``` 在C++中使用opencv nonfree部分,我已经将opencv_contrib编译进去,并在VS2015中加入了依赖项等,但是在使用FREAK的时候依然报错“0x00007FF82E8A7788 处(位于 ConsoleApplication1.exe 中)有未经处理的异常: Microsoft C++ 异常: cv::Exception,位于内存位置 0x0000009443EEF4E0 处。”。我猜测是因为FREAK的定义问题,opencv3+之后与opencv2有部分不同。小白一枚了解不多,度娘和Github都解救不了我,望大神告知。

vs2012配置opencv后,函数报错,求大神解释

我在配置好opencv2.4.10之后,找了个程序测试一下,但是程序中所有的opencv库中的函数都报错,说是为定义的标示符,但是opencv的库函数我已经链接输入了。搞了好久,求大神解答额

请教:尝试opencv2.4.13在linux下编译程序的报错

源代码:#include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/core/core.hpp> using namespace cv; int main() { VideoCapture cap(0); if(!cap.isOpened()) { return -1; } Mat frame; bool stop = false; while(!stop) { cap.read(frame); imshow("Video",frame); if(waitKey(30)==27) //Esc键退出 { stop = true; } } return 0; } 报错:~$ g++ -o opencvq opencv.cpp /tmp/ccQJKVIi.o: In function `main': opencv.cpp:(.text+0x29): undefined reference to `cv::VideoCapture::VideoCapture(int)' opencv.cpp:(.text+0x38): undefined reference to `cv::VideoCapture::isOpened() const' opencv.cpp:(.text+0x80): undefined reference to `cv::VideoCapture::read(cv::Mat&)' opencv.cpp:(.text+0xf9): undefined reference to `cv::Mat::ones(cv::Size_<int>, int)' opencv.cpp:(.text+0x146): undefined reference to `cv::VideoCapture::read(cv::Mat&)' opencv.cpp:(.text+0x33d): undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)' opencv.cpp:(.text+0x356): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)' opencv.cpp:(.text+0x36f): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)' opencv.cpp:(.text+0x3a1): undefined reference to `cv::addWeighted(cv::_InputArray const&, double, cv::_InputArray const&, double, double, cv::_OutputArray const&, int)' opencv.cpp:(.text+0x3ba): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)' opencv.cpp:(.text+0x3fd): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)' opencv.cpp:(.text+0x425): undefined reference to `cv::waitKey(int)' opencv.cpp:(.text+0x489): undefined reference to `cv::VideoCapture::~VideoCapture()' opencv.cpp:(.text+0x51a): undefined reference to `cv::VideoCapture::~VideoCapture()' /tmp/ccQJKVIi.o: In function `cv::Mat::~Mat()': opencv.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)' /tmp/ccQJKVIi.o: In function `cv::Mat::release()': opencv.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x47): undefined reference to `cv::Mat::deallocate()' /tmp/ccQJKVIi.o: In function `cv::Mat::operator()(cv::Rect_<int> const&) const': opencv.cpp:(.text._ZNK2cv3MatclERKNS_5Rect_IiEE[_ZNK2cv3MatclERKNS_5Rect_IiEE]+0x27): undefined reference to `cv::Mat::Mat(cv::Mat const&, cv::Rect_<int> const&)' collect2: error: ld returned 1 exit status 第一次使用,在此请教各位前辈,谢谢了

opencv程序不能在别的电脑上运行

我写了个简单的opencv程序,然后拷到另一个没装opencv的电脑上,即使我把所有dll拷过去了,也还是不能跑,显示“应用程序无法正常启动,0x000000007”什么的。在我自己的电脑上运行正常啊。

使用opencv cvSaveImage保存图片报错

我用cvSaveImage保存图片时发生异常,保存路径是用字符串拼起来的,路径中有中文就报错,没有中文就正常,请问这个问题怎么解决,下面是我的代码 ``` string file_dst = "D:/wcx/111/"; file_dst += picture[i].name; file_dst += ".jpg"; cvSaveImage(file_dst.c_str(), pImageDst); ``` 其中picture[i].name获取的是string类型的字符串

opencv3.0霍夫圆书上的程序 不知道为什么会报错

//我把HoughCircle()之后的都注释掉了,不知道为什么会在最后return 0的时候报错,应该是vector的堆损坏了 ``` //-----------------------------------【头文件包含部分】--------------------------------------- // 描述:包含程序所依赖的头文件 //---------------------------------------------------------------------------------------------- #include <opencv2/opencv.hpp> #include <opencv2/imgproc/imgproc.hpp> //-----------------------------------【命名空间声明部分】--------------------------------------- // 描述:包含程序所使用的命名空间 //----------------------------------------------------------------------------------------------- using namespace cv; using namespace std; //-----------------------------------【main( )函数】-------------------------------------------- // 描述:控制台应用程序的入口函数,我们的程序从这里开始 //----------------------------------------------------------------------------------------------- int main() { //【1】载入原始图和Mat变量定义 Mat srcImage = imread("66.jpg"); //工程目录下应该有一张名为1.jpg的素材图 Mat midImage,dstImage;//临时变量和目标图的定义 //【2】显示原始图 imshow("【原始图】", srcImage); //【3】转为灰度图,进行图像平滑 cvtColor(srcImage, midImage, CV_BGR2GRAY);//转化边缘检测后的图为灰度图 GaussianBlur(midImage, midImage, Size(9, 9), 2, 2); //【4】进行霍夫圆变换 vector<Vec3f> circles; //用destImage代替circles不会报错,不过这样就没意义了 //HoughCircles(midImage, dstImage, CV_HOUGH_GRADIENT, 1.5, 10, 200, 100, 0, 0); HoughCircles(midImage, circles, CV_HOUGH_GRADIENT, 1.5, 10, 200, 100, 0, 0); //【5】依次在图中绘制出圆 /*for (size_t i = 0; i < circles.size(); i++) { Point center(cvRound(circles[i][0]), cvRound(circles[i][1])); int radius = cvRound(circles[i][2]); //绘制圆心 circle(srcImage, center, 3, Scalar(0, 255, 0), -1, 8, 0); //绘制圆轮廓 circle(srcImage, center, radius, Scalar(155, 50, 255), 3, 8, 0); } //【6】显示效果图 imshow("【效果图】", srcImage); waitKey(0);*/ circles.clear(); return 0; } ``` 出这个对话框 0x00007FF77358433E 处(位于 opencvtext.exe 中)引发的异常: 0xC0000005: 读取位置 0xFFFFFFFFFFFFFFFF 时发生访问冲突。 如有适用于此异常的处理程序,该程序便可安全地继续运行。 ![图片说明](https://img-ask.csdn.net/upload/201603/01/1456834421_525664.png)

vs中用opencv库调试程序,release可以跑,debug不能

我在调程序的时候,用release能够正常的跑,也能出结果,但是换成debug时,会出一大堆的"无法查找或打开pdb文件",请问有谁知道这是怎么回事呀?

cmake编译opencv3.2+opencv_contrib一直报错。。

一直会提示这个错,有大神知道原因吗,我把一些依赖包下载下来放固定目录里了。还是该提醒还提醒错。我用的是opencv3.2+vs2015。 CMake Error at H:/OpenCV/opencv/sources/cmake/OpenCVUtils.cmake:1005 (file): file MD5 failed to read file "H:/OpenCV/Library/3rdparty/protobuf/": Permission denied Call Stack (most recent call first): H:/OpenCV/opencv_contrib-master/modules/dnn/cmake/OpenCVFindLibProtobuf.cmake:32 (ocv_download) H:/OpenCV/opencv_contrib-master/modules/dnn/CMakeLists.txt:5 (include)![图片说明](http://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/monkey/11.gif)![图片说明](http://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/monkey/5.gif)

python-opencv中imshow总报错的问题

我用的是visual studio2017,自带安装的Anaconda2,pip安装的opencv-python,在我调用imshow函数的时候总是报错 cv2.error Message=C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:331: error: (-215) size.width>0 && size.height>0 in function cv::imshow StackTrace: <module> 中的 C:\Users\Administrator\source\repos\PythonApplication1\PythonApplication1\PythonApplication1.py:4 ![图片说明](https://img-ask.csdn.net/upload/201803/13/1520901830_939155.png) ![图片说明](https://img-ask.csdn.net/upload/201803/13/1520901843_820072.png) 求大佬帮忙解答下

请问这段opencv代码为什么在debug下无法编译通过,但是release可以通过?

``` #include<opencv2\core\core.hpp> #include<opencv2\highgui\highgui.hpp> using namespace cv; void main() { Mat image=imread("E:\\images\\07.jpg"); namedWindow("img"); imshow("img", image); waitKey(0); } ``` 编译环境为opencv2.4.11+vs2013。这段最简单的测试程序无法在debug下编译通过。 ![图片说明](https://img-ask.csdn.net/upload/201509/17/1442475731_362233.png) ![图片说明](https://img-ask.csdn.net/upload/201509/17/1442475692_384048.png) 附加依赖项为 opencv_calib3d2411.lib opencv_contrib2411.lib opencv_core2411.lib opencv_features2d2411.lib opencv_flann2411.lib opencv_gpu2411.lib opencv_highgui2411.lib opencv_imgproc2411.lib opencv_legacy2411.lib opencv_ml2411d.lib opencv_objdetect2411.lib opencv_ts2411.lib opencv_video2411.lib opencv_nonfree2411.lib opencv_ocl2411.lib opencv_photo2411.lib opencv_stitching2411.lib opencv_superres2411.lib opencv_videostab2411.lib opencv_calib3d2411d.lib opencv_contrib2411d.lib opencv_core2411d.lib opencv_features2d2411d.lib opencv_flann2411d.lib opencv_gpu2411d.lib opencv_highgui2411d.lib opencv_imgproc2411d.lib opencv_legacy2411d.lib opencv_objdetect2411d.lib opencv_ts2411d.lib opencv_video2411d.lib opencv_nonfree2411d.lib opencv_ocl2411d.lib opencv_photo2411d.lib opencv_stitching2411d.lib opencv_superres2411d.lib opencv_videostab2411d.lib 报的错误是 ![图片说明](https://img-ask.csdn.net/upload/201509/17/1442475851_593908.png)

OpenCV3.3 在运行到函数末尾时,Mat::release()函数出错

![图片说明](https://img-ask.csdn.net/upload/201804/15/1523784871_164835.png),报错信息“引发了异常:写入权限冲突。this->u是0x01”,一头雾水,不知什么原因造成的,求助!

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

你以为这样写Java代码很6,但我看不懂

为了提高 Java 编程的技艺,我最近在 GitHub 上学习一些高手编写的代码。下面这一行代码(出自大牛之手)据说可以征服你的朋友,让他们觉得你写的代码很 6,来欣赏一下吧。 IntStream.range(1, 5).boxed().map(i -&gt; { System.out.print("Happy Birthday "); if (i == 3) return "dear NAME"...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

程序员写出这样的代码,能不挨骂吗?

当你换槽填坑时,面对一个新的环境。能够快速熟练,上手实现业务需求是关键。但是,哪些因素会影响你快速上手呢?是原有代码写的不够好?还是注释写的不够好?昨夜...

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

Python爬虫,高清美图我全都要(彼岸桌面壁纸)

爬取彼岸桌面网站较为简单,用到了requests、lxml、Beautiful Soup4

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

Java岗开发3年,公司临时抽查算法,离职后这几题我记一辈子

前几天我们公司做了一件蠢事,非常非常愚蠢的事情。我原以为从学校出来之后,除了找工作有测试外,不会有任何与考试有关的事儿。 但是,天有不测风云,公司技术总监、人事总监两位大佬突然降临到我们事业线,叫上我老大,给我们组织了一场别开生面的“考试”。 那是一个风和日丽的下午,我翘着二郎腿,左手端着一杯卡布奇诺,右手抓着我的罗技鼠标,滚动着轮轴,穿梭在头条热点之间。 “淡黄的长裙~蓬松的头发...

大牛都会用的IDEA调试技巧!!!

导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

立即提问
相关内容推荐