1 | initial version |
hi Nate, simple answer, - you have to set the roi before calling cvShowImage.
besides that , 2 remarks:
next time, please add the actual code, not a screenshot of it (will make it easier for others to try/modify it)
if you're just starting with opencv (and thus don't have a ton a of legacy code to support), please avoid the old c-api, support for that is fading quickly, please move over to c++ asap.
so, the more modern version of your code would be like this:
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
int main()
{
namedWindow("Example1");
Mat img = imread("a:/very/long/path/to/o1.jpg");
Mat roi = img( Rect(150,50,150,250) );
imshow("Example1",roi);
waitKey(0);
return 0; // yea, c++, no cleanup nessecary!
}
2 | No.2 Revision |
hi Nate, simple answer, - you have to set the roi before calling cvShowImage.
besides that , 2 remarks:
next time, please add the actual code, not a screenshot of it (will make it easier for others to try/modify it)
if you're just starting with opencv (and thus don't have a ton a of legacy code to support), please avoid the old c-api, support for that is fading quickly, please move over to c++ asap.
so, the more modern version of your code would be like this:
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
int main()
{
namedWindow("Example1");
Mat img = imread("a:/very/long/path/to/o1.jpg");
Mat roi = img( Rect(150,50,150,250) );
imshow("Example1",roi);
waitKey(0);
return 0; // yea, c++, no cleanup nessecary!
}
3 | No.3 Revision |
hi Nate, simple answer, - you have to set the roi before calling cvShowImage.
besides that , 2 remarks:
next time, please add the actual code, not a screenshot (will make it easier for others to try/modify it)
if you're just starting with opencv (and thus don't have a ton a of legacy code to support), please avoid the old c-api, support for that is fading quickly, please move over to c++ asap.
so, the more modern version of your code would be like this:
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
int main()
{
namedWindow("Example1");
Mat img = imread("a:/very/long/path/to/o1.jpg");
Mat roi = img( Rect(150,50,150,250) );
imshow("Example1",roi);
waitKey(0);
return 0; // yea, c++, no cleanup nessecary!
}
".But Im not give up !!!" - ;) yea.
4 | No.4 Revision |
hi Nate, simple answer, - you have to set the roi before calling cvShowImage.
besides that , 2 remarks:
next time, please add the actual code, not a screenshot (will make it easier for others to try/modify it)
if you're just starting with opencv (and thus don't have a ton a of legacy code to support), please avoid the old c-api, support for that is fading quickly, please move over to c++ asap.
so, the more modern version of your code would be like this:
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
int main()
{
namedWindow("Example1");
Mat img = imread("a:/very/long/path/to/o1.jpg");
if ( img.empty() ) { /* bark!!*/ }
Mat roi = img( Rect(150,50,150,250) );
imshow("Example1",roi);
waitKey(0);
return 0; // yea, c++, no cleanup nessecary!
}
".But Im not give up !!!" - ;) yea.