Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8323105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:36:52+00:00 2026-06-08T23:36:52+00:00

i am collecting Good frames from two cameras for stereo camera calibration purpose. #include

  • 0

i am collecting Good frames from two cameras for stereo camera calibration purpose.

  #include <iostream>
  #include <cv.h>
  #include <highgui.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <sstream>

  using namespace std;

  int main() {

  CvCapture* videocapture_CAM0=cvCreateCameraCapture(0);    
  CvCapture* videocapture_CAM1=cvCreateCameraCapture(1);

  IplImage* img_0;    
  IplImage* img_1;

  int nx=4,ny=3;

  int i, j, nframes, n = nx*ny;

  vector<CvPoint2D32f> temp_0(n);    
  vector<CvPoint2D32f> temp_1(n);

  CvSize imageSize_0 = {0,0};    
  CvSize imageSize_1 = {0,0};

  while(1)  
  {
      int count_0 = 0,count_1 = 0;
      int result_0 = 0,result_1 = 0;

      img_0=cvQueryFrame(videocapture_CAM0);
      img_1=cvQueryFrame(videocapture_CAM1);

      imageSize_0 = cvGetSize(img_0);
      imageSize_1 = cvGetSize(img_1);    

      cvShowImage("camera 1", img_0);
      cvShowImage("camera 2", img_1);

      IplImage* timg_0 = img_0;
      IplImage* timg_1 = img_1;

      result_0 = cvFindChessboardCorners(timg_0, cvSize(nx, ny), &temp_0[0], &count_0,
                            CV_CALIB_CB_ADAPTIVE_THRESH | CV_CALIB_CB_NORMALIZE_IMAGE);

      result_1 = cvFindChessboardCorners(timg_1, cvSize(nx, ny), &temp_1[0], &count_1, 
                            CV_CALIB_CB_ADAPTIVE_THRESH | CV_CALIB_CB_NORMALIZE_IMAGE);

      if(result_0&&result_1)
      {
            cout<<"Found"<<endl;

            IplImage* cimg_0 = cvCreateImage(imageSize_0, 8, 3);            

            IplImage* cimg_1 = cvCreateImage(imageSize_1,8,3);

            cvCvtColor(img_0, cimg_0, CV_GRAY2BGR);
            cvCvtColor(img_1, cimg_1, CV_GRAY2BGR);

            cvDrawChessboardCorners(cimg_0, cvSize(nx, ny), &temp_0[0], count_0, 
                                    result_0);

            cvDrawChessboardCorners(cimg_1, cvSize(nx, ny), &temp_1[0], count_1,
                                    result_1);

            cvShowImage("corners", cimg_0);
            cvShowImage("corners", cimg_1);

            cvReleaseImage(&cimg_0);
            cvReleaseImage(&cimg_1);

            cvWaitKey(5);

       }
       char c=cvWaitKey(30);
       if(c==27)
        break;
     }
     return 0;
  }

but i’m getting a weird error at run time :-

OpenCV Error: Assertion failed (scn == 1 && (dcn == 3 || dcn == 4)) in cvtColor,
 file C:\opencv\modules\imgproc\src\color.cpp, line 3234

also, i have checked that Dimension and nchannel values of both source and destination images are equal.

thanks in advance!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T23:36:54+00:00Added an answer on June 8, 2026 at 11:36 pm

    The assertion is very clear scn == 1 means your source image must have one channel (thats beacuse you specified CV_GRAY2BGR as conversion code for cvCvtColor).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Collecting the admin-media files from different django application is one of the not-so-good things
Is there any good JAVA lib for playing with reading from WSDL's and connecting
I'm collecting latitude and longitude from Mobile Safari with some JavaScript code. After collecting
I don't understand garbage collection so good, then I want to know, why it's
Is this a good approach to filtering a backbone collection on multiple attributes: filterData:
What is a good way to represent a collection of bits? I have a
good stuff // ok to alias a List Type using AliasStringList = System.Collections.Generic.List<string>; //
as the title implies i am searching for a good pattern / schema collection
So, I've spent a good amount of time using ContinuousLinq to bind collections to
I am collecting data every five minutes and entering it into a MySQL database.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.