Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked Sep 21 '12

zenberg gravatar image

ROI Errors and the Stitcher module

I have two pictures, each one of them has these dimensions: 2592x1926.

When I try to stitch them using the Stitcher module it takes about 3-4 minutes on the iPhone 4, so I decided to specify ROI to decrease the calculation time.

Here's my code:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); //roi is half of image
cv::vector<cv::Rect> roi;
roi.push_back(rect);

cv::vector<cv::vector<cv::Rect>> rois;
rois.push_back(roi);

cv::Mat imgOut;
cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);


At the end I got this error:

Finding features...
OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /Users/user/slave/ios_framework/src/opencv/modules/core/src/matrix.cpp, line 322



Do you have any ideas how to solve this?

click to hide/show revision 2
No.2 Revision

ROI Errors and the Stitcher module

I have two pictures, each one of them has these dimensions: 2592x1926.

When I try to stitch them using the Stitcher module it takes about 3-4 minutes on the iPhone 4, so I decided to specify ROI to decrease the calculation time.

Here's my code:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); //roi is half of image
cv::vector<cv::Rect> roi;
roi.push_back(rect);

cv::vector<cv::vector<cv::Rect>> rois;
rois.push_back(roi);

cv::Mat imgOut;
cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);


At the end I got this error:

Finding features...
OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /Users/user/slave/ios_framework/src/opencv/modules/core/src/matrix.cpp, line 322



Do UPDATE
I tried to put two ROIs into the vector. The code looks like this:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); //second half of the first image
cv::Rect rect2 = cvRect(0, 0, img2_1.cols/2, img2_1.rows); //first half of the second image

cv::vector<cv::Rect> roi;
roi.push_back(rect);
roi.push_back(rect2);
rois.push_back(roi);

cv::Mat imgOut;
cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);

And still I get the same error. Both images have the same size(2592x1936).

Actually I tried to find the appropriate parameters for ROI and found out that the max possible value is:

cv::Rect rect = cvRect(0, 0, 550, 550);


When I'm trying this:

cv::Rect rect = cvRect(0, 0, 600, 600);

sometime it isn't showing the error, but in most cases it is.

Can you have any ideas how to solve this?please tell me where the problem is?

click to hide/show revision 3
No.3 Revision

ROI Errors and the Stitcher module

I have two pictures, each one of them has these dimensions: 2592x1926.

When I try to stitch them using the Stitcher module it takes about 3-4 minutes on the iPhone 4, so I decided to specify ROI to decrease the calculation time.

Here's my code:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); //roi is half of image
cv::vector<cv::Rect> roi;
roi.push_back(rect);

cv::vector<cv::vector<cv::Rect>> rois;
rois.push_back(roi);

cv::Mat imgOut;
cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);


At the end I got this error:

Finding features...
OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /Users/user/slave/ios_framework/src/opencv/modules/core/src/matrix.cpp, line 322



UPDATE
I tried to put two ROIs into the vector. The code looks like this:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); //second half of the first image
cv::Rect rect2 = cvRect(0, 0, img2_1.cols/2, img2_1.rows); //first half of the second image

cv::vector<cv::Rect> roi;
roi.push_back(rect);
roi.push_back(rect2);
rois.push_back(roi);

cv::Mat imgOut;
cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);

And still I get the same error. Both images have the same size(2592x1936).

Actually I tried to find the appropriate parameters for ROI and found out that the max possible value is:

cv::Rect rect = cvRect(0, 0, 550, 550);


When I'm trying this:

cv::Rect rect = cvRect(0, 0, 600, 600);

sometime sometimes it isn't showing the error, but in most cases it is.


Can you please tell me where the problem is?

click to hide/show revision 4
No.4 Revision

ROI Errors and the Stitcher module

I have two pictures, each one of them has these dimensions: 2592x1926.

When I try to stitch them using the Stitcher module it takes about 3-4 minutes on the iPhone 4, so I decided to specify ROI to decrease the calculation time.

Here's my code:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); //roi is half of image
cv::vector<cv::Rect> roi;
roi.push_back(rect);

cv::vector<cv::vector<cv::Rect>> rois;
rois.push_back(roi);

cv::Mat imgOut;
cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);


At the end I got this error:

Finding features...
OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /Users/user/slave/ios_framework/src/opencv/modules/core/src/matrix.cpp, line 322



UPDATE
I tried to put two ROIs into the vector. The code looks like this:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); //second half of the first image
cv::Rect rect2 = cvRect(0, 0, img2_1.cols/2, img2_1.rows); //first half of the second image

cv::vector<cv::Rect> roi;
roi.push_back(rect);
roi.push_back(rect2);
rois.push_back(roi);

cv::Mat imgOut;
cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);

And still I get the same error. Both images have the same size(2592x1936).

Actually I tried to find the appropriate parameters for ROI and found out that the max possible value is:

cv::Rect rect = cvRect(0, 0, 550, 550);


When I'm trying to do this:

cv::Rect rect = cvRect(0, 0, 600, 600);

it sometimes it isn't showing doesn't show the error, but in most cases it is. does.


Can you please tell me where the problem is?

click to hide/show revision 5
No.5 Revision

ROI Errors and the Stitcher module

I have two pictures, each one of them has these dimensions: 2592x1926.

When I try to stitch them using the Stitcher module it takes about 3-4 minutes on the iPhone 4, so I decided to specify ROI to decrease the calculation time.

Here's my code:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); //roi is half of image
cv::vector<cv::Rect> roi;
roi.push_back(rect);

cv::vector<cv::vector<cv::Rect>> rois;
rois.push_back(roi);

cv::Mat imgOut;
cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);


At the end I got this error:

Finding features...
OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /Users/user/slave/ios_framework/src/opencv/modules/core/src/matrix.cpp, line 322



UPDATE
I tried to put two ROIs into the vector. The code looks like this:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); //second half of the first image
cv::Rect rect2 = cvRect(0, 0, img2_1.cols/2, img2_1.rows); //first half of the second image

cv::vector<cv::Rect> roi;
roi.push_back(rect);
roi.push_back(rect2);
rois.push_back(roi);

cv::Mat imgOut;
cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);

And still I get the same error. Both images have the same size(2592x1936).

size(2592x1936).

Actually I tried to find the appropriate parameters for ROI and found out that the max possible value is:

cv::Rect rect = cvRect(0, 0, 550, 550);


When I'm trying to do this:

cv::Rect rect = cvRect(0, 0, 600, 600);

it sometimes doesn't show the error, but in most cases it does.


Can you please tell me where the problem is?

click to hide/show revision 6
No.6 Revision

ROI Errors and the Stitcher module

I have two pictures, each one of them has these dimensions: 2592x1926.

When I try to stitch them using the Stitcher module it takes about 3-4 minutes on the iPhone 4, so I decided to specify ROI to decrease the calculation time.

Here's my code:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); //roi is half of image
cv::vector<cv::Rect> roi;
roi.push_back(rect);

cv::vector<cv::vector<cv::Rect>> rois;
rois.push_back(roi);

cv::Mat imgOut;
cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);


At the end I got this error:

Finding features...
OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /Users/user/slave/ios_framework/src/opencv/modules/core/src/matrix.cpp, line 322



UPDATE
I tried to put two ROIs into the vector. The code looks like this:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); //second half of the first image
cv::Rect rect2 = cvRect(0, 0, img2_1.cols/2, img2_1.rows); //first half of the second image

cv::vector<cv::Rect> roi;
roi.push_back(rect);
roi.push_back(rect2);
rois.push_back(roi);

cv::Mat imgOut;
cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);

And still I get the same error. Both images have the same size(2592x1936).


Actually I tried to find the appropriate parameters for ROI and found out that the max possible value is:

cv::Rect rect = cvRect(0, 0, 550, 550);


When I'm trying to do this:

cv::Rect rect = cvRect(0, 0, 600, 600);

it sometimes doesn't show the error, but in most cases it does.


Can you please tell me where the problem is?

click to hide/show revision 7
update #2

ROI Errors and the Stitcher module

I have two pictures, each one of them has these dimensions: 2592x1926.

When I try to stitch them using the Stitcher module it takes about 3-4 minutes on the iPhone 4, so I decided to specify ROI to decrease the calculation time.

Here's my code:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); //roi is half of image
cv::vector<cv::Rect> roi;
roi.push_back(rect);

cv::vector<cv::vector<cv::Rect>> rois;
rois.push_back(roi);

cv::Mat imgOut;
cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);


At the end I got this error:

Finding features...
OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /Users/user/slave/ios_framework/src/opencv/modules/core/src/matrix.cpp, line 322



UPDATE
I tried to put two ROIs into the vector. The code looks like this:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); //second half of the first image
cv::Rect rect2 = cvRect(0, 0, img2_1.cols/2, img2_1.rows); //first half of the second image

cv::vector<cv::Rect> roi;
roi.push_back(rect);
roi.push_back(rect2);
rois.push_back(roi);

cv::Mat imgOut;
cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);

And still I get the same error. Both images have the same size(2592x1936).


Actually I tried to find the appropriate parameters for ROI and found out that the max possible value is:

cv::Rect rect = cvRect(0, 0, 550, 550);


When I'm trying to do this:

cv::Rect rect = cvRect(0, 0, 600, 600);

it sometimes doesn't show the error, but in most cases it does.


UPDATE #2
Now my code looks like this:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); cv::vector<cv::rect> roi; roi.push_back(rect);

cv::Rect rect2 = cvRect(0, 0, img2_1.cols/2, img2_1.rows); cv::vector<cv::rect> roi2; roi2.push_back(rect2);

cv::vector<cv::vector<cv::rect>> rois; rois.resize(2); rois[0] = roi; rois[1] = roi2;

cv::Mat imgOut; cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);

And I still get the same error.




Can you please tell me where the problem is?what's the problem?

click to hide/show revision 8
No.8 Revision

ROI Errors and the Stitcher module

I have two pictures, each one of them has these dimensions: 2592x1926.

When I try to stitch them using the Stitcher module it takes about 3-4 minutes on the iPhone 4, so I decided to specify ROI to decrease the calculation time.

Here's my code:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); //roi is half of image
cv::vector<cv::Rect> roi;
roi.push_back(rect);

cv::vector<cv::vector<cv::Rect>> rois;
rois.push_back(roi);

cv::Mat imgOut;
cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);


At the end I got this error:

Finding features...
OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /Users/user/slave/ios_framework/src/opencv/modules/core/src/matrix.cpp, line 322



UPDATE
I tried to put two ROIs into the vector. The code looks like this:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows); //second half of the first image
cv::Rect rect2 = cvRect(0, 0, img2_1.cols/2, img2_1.rows); //first half of the second image

cv::vector<cv::Rect> roi;
roi.push_back(rect);
roi.push_back(rect2);
rois.push_back(roi);

cv::Mat imgOut;
cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);

And still I get the same error. Both images have the same size(2592x1936).


Actually I tried to find the appropriate parameters for ROI and found out that the max possible value is:

cv::Rect rect = cvRect(0, 0, 550, 550);


When I'm trying to do this:

cv::Rect rect = cvRect(0, 0, 600, 600);

it sometimes doesn't show the error, but in most cases it does.


UPDATE #2
Now my code looks like this:

cv::Rect rect = cvRect(img1_1.cols/2, 0, img1_1.cols/2, img1_1.rows);
cv::vector<cv::rect> cv::vector<cv::Rect> roi;
roi.push_back(rect);

roi.push_back(rect); cv::Rect rect2 = cvRect(0, 0, img2_1.cols/2, img2_1.rows); cv::vector<cv::rect> cv::vector<cv::Rect> roi2; roi2.push_back(rect2);

cv::vector<cv::vector<cv::rect>> roi2.push_back(rect2); cv::vector<cv::vector<cv::Rect>> rois; rois.resize(2); rois[0] = roi; rois[1] = roi2;

roi2; cv::Mat imgOut; cv::Stitcher::Status status = stitcher.stitch(images, rois, imgOut);

imgOut);

And I still get the same error.




Can you please tell me what's the problem?