Advertisement
Guest User

Assertion failed bug

a guest
Mar 8th, 2016
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. #include <opencv2/core/core.hpp>
  2. #include <opencv2/imgproc/imgproc.hpp>
  3. #include <opencv2/highgui/highgui.hpp>
  4.  
  5. using namespace cv;
  6.  
  7.  
  8. int main( int argc, char** argv )
  9. {
  10.     namedWindow( "Display window", WINDOW_AUTOSIZE );
  11.  
  12.     Mat result;
  13.  
  14.     Mat R = imread("C:\\Lenna.png", CV_LOAD_IMAGE_GRAYSCALE);
  15.     Mat G = imread("C:\\Lenna.png", CV_LOAD_IMAGE_GRAYSCALE);
  16.     Mat B = imread("C:\\Lenna.png", CV_LOAD_IMAGE_GRAYSCALE);
  17.  
  18.     // Changing colors for final result that should look largely blue
  19.     R = 0.1*R;
  20.     G = 0.1*G;
  21.     B = 1.5*B;
  22.  
  23.     std::vector<cv::Mat> array_to_merge ;
  24.  
  25.     array_to_merge.push_back(B);
  26.     array_to_merge.push_back(G);
  27.     array_to_merge.push_back(R);
  28.  
  29.     // HERE an assertion failed error happens in release mode only
  30.     //cv::merge(array_to_merge,result);
  31.  
  32.     // This however does not cause any debug or release crash
  33.     cv::merge(&array_to_merge[0], array_to_merge.size(), result);
  34.  
  35.  
  36.     cv::imshow( "Display window", result );
  37.     cv::waitKey(0);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement