Ask Your Question

srakowski's profile - activity

2013-09-06 07:21:21 -0500 commented question OpenCV png c++ assertion failed

hmmm. i have no ide , because i am creating CImg<unsigned char> and it works but as i said with vec4b it write good some images , with vec4w write good with type -- 26

2013-09-06 06:54:39 -0500 commented question OpenCV png c++ assertion failed

btw. i tried rewrite part with CImg to openCV and there only one method from CImg cause trouble for me: finalimg.append(finalimg2,'y',0); Because there are not the same in opencv (i tried += , but there are not the same size...)

2013-09-06 06:52:35 -0500 commented question OpenCV png c++ assertion failed

had type == 24 (at the end)

2013-09-06 06:51:58 -0500 commented answer OpenCV png c++ assertion failed

EDITED!!!!!

2013-09-06 06:51:06 -0500 received badge  Editor (source)
2013-09-06 06:32:48 -0500 commented answer OpenCV png c++ assertion failed

On this moment it works in 90%, because i write it to CImg with if/else (using vec4b and vec4w), but i merge all images into one with CImg, and now my problem is how to good rewrite ready image, i mean: (I am sorry for bad style): Mat tmp = Mat(finalimg.width(), finalimg.height(), DataType<cv::Vec4w>::type); // Rewrite from CImg to opencvi kno w for(int l = 0 ; l < finalimg.width() ; l++){ for(int ll = 0 ; ll < finalimg.height() ; ll++){ tmp.at<cv::Vec4w>(ll,l)[0] = finalimg(l,ll, 0 , 0); tmp.at<cv::Vec4w>(ll,l)[1] = finalimg(l,ll, 0 , 1); tmp.at<cv::Vec4w>(ll,l)[2] = finalimg(l,ll, 0 , 2); tmp.at<cv::Vec4w>(ll,l)[3] = finalimg(l,ll, 0 , 3); } }

    char resultName[15];
    //sprintf(resultName, "result%d.png", p);
    imwrite("result.png", tmp);

??? use vec4b ?

2013-09-06 06:20:24 -0500 commented answer OpenCV png c++ assertion failed

WORKS!!! iF YOU WANT MONEY I CAN PAY ON FREELANCER.COM ?

2013-09-06 06:11:34 -0500 commented answer OpenCV png c++ assertion failed

so there is bad type, but how to cast this, please ?

2013-09-06 05:55:45 -0500 commented answer OpenCV png c++ assertion failed

http://postimg.org/image/bemf4a1e5/

I see that temp.type() for index 0 is 24, and it is good processing For second image = index 1, temp.type() = 26 ???

2013-09-06 05:32:24 -0500 commented answer OpenCV png c++ assertion failed
2013-09-06 05:18:43 -0500 commented answer OpenCV png c++ assertion failed

imread(f_name, -1); Still give me assertion...

2013-09-06 04:50:15 -0500 asked a question OpenCV png c++ assertion failed

Hi! My Code is:

Mat temp = imread(f_name, 1);


    cout << temp.channels() << "chanels in image" << endl ;
            getch()

;
        img = CImg<unsigned char>(temp.cols, temp.rows, 1, 4);
        width = img.width();
        high = img.height();
        static int ii = 0;
            cout << "Image readed nr " << ii << endl;
        // Rewrite from opencv to CImg
        for(int l = 0 ; l < width ; l++){
            for(int ll = 0 ; ll < high ; ll++){
                img (l,ll, 0 , 0) = temp.at<cv::Vec4b>(ll,l)[0]; 
                img (l,ll, 0 , 1) = temp.at<cv::Vec4b>(ll,l)[1]; 
                img (l,ll, 0 , 2) = temp.at<cv::Vec4b>(ll,l)[2];
                img (l,ll, 0 , 3) = temp.at<cv::Vec4b>(ll,l)[3]; // aplha chanell
            }
        }

It compile well, but in runtime there is assertion failed with mat.hpp in line 537. If i commented loops everything works without result ok.

Please Do Yiou have some ideas, please ?

Best Regards, Szymsztein

Edit:

Current code works, but rewriting from cimg to opencv not... :

CImg<unsigned char> finalimg2(x,a);
    ////////////////////////////////////////
    ////////////////////////////
    finalimg.append(finalimg2,'y',0);

    Mat tmp = Mat(finalimg.width(), finalimg.height(), DataType<cv::Vec4w>::type);
    // Rewrite from CImg to opencvi kno w
        for(int l = 0 ; l < finalimg.width() ; l++){
            for(int ll = 0 ; ll < finalimg.height() ; ll++){
                if( sizeof(finalimg(l,ll,0,0)) != 8)
                    cout << "(" << l << ", " << ll << ") size = " << sizeof(finalimg(l,ll,0,0)) << " ";
                tmp.at<cv::Vec4w>(ll,l)[0] = finalimg(l,ll, 0 , 0);
                tmp.at<cv::Vec4w>(ll,l)[1] = finalimg(l,ll, 0 , 1); 
                tmp.at<cv::Vec4w>(ll,l)[2] = finalimg(l,ll, 0 , 2); 
                tmp.at<cv::Vec4w>(ll,l)[3] = finalimg(l,ll, 0 , 3); 
            }
        }

        char resultName[15];
        //sprintf(resultName, "result%d.png", p);
        imwrite("result.png", tmp);

When i use Ve4w, these images which had type == 26, works well and are on output message, when i use vec4b, on output images there are only these images awhich had type ==26...

2013-09-06 04:49:23 -0500 asked a question OpenCV png c++ assertion failed

Hi! My Code is:

<code>

Mat temp = imread(f_name, 1); cout << temp.channels() << "chanels in image" << endl ; getch(); img = CImg<unsigned char="">(temp.cols, temp.rows, 1, 4); width = img.width(); high = img.height(); static int ii = 0; cout << "Image readed nr " << ii << endl; // Rewrite from opencv to CImg for(int l = 0 ; l < width ; l++){ for(int ll = 0 ; ll < high ; ll++){ img (l,ll, 0 , 0) = temp.at<cv::vec4b>(ll,l)[0]; img (l,ll, 0 , 1) = temp.at<cv::vec4b>(ll,l)[1]; img (l,ll, 0 , 2) = temp.at<cv::vec4b>(ll,l)[2]; img (l,ll, 0 , 3) = temp.at<cv::vec4b>(ll,l)[3]; // aplha chanell } }

</code>

It compile well, but in runtime there is assertion failed with mat.hpp in line 537. If i commented loops everything works without result ok.

Please Do Yiou have some ideas, please ?

Best Regards, Szymsztein