# Revision history [back]

I am not sure that "Learning OpenCV" is a good book for novice, because it is quite outdated. It was writen for OpenCV 1.0. OpenCV 2.4.3 was reased few days ago. OpenCV 1.0 had very difficult non-intuitive inteface, one of the issues that was fixed in OpenCV 2. And so you are learning how to do things in a complicate way and use functions some of which are already depricated. Don't take it wrong, this is a very good book that was very helpful back then, but I don't think it is good for you now.

As for your question, some of those old functions indeed ignored ROI even if it is was defined. I am not sure but it is possible that cvCalcHist was one of them. New image format of OpenCV (called Mat) don't even has such field as ROI. Instead you can define partial images in convenient way that has same function (and of course witout memory). Your code will look like:

Mat whole_image = imread(image_name);
Rect ROI;
...
Mat part_of_image(whole_image, ROI);


And then you provide part_of_image to calcHist and do the rest of the job.

Here you can read more about interface of calcHist and see example of its use.

I am not sure that "Learning OpenCV" is a good book for novice, because it is quite outdated. It was writen for OpenCV 1.0. OpenCV 2.4.3 was reased few days ago. OpenCV 1.0 had very difficult non-intuitive inteface, one of the issues that was fixed in OpenCV 2. And so you are learning how to do things in a complicate way and use functions some of which are already depricated. Don't take it wrong, this is a very good book that was very helpful back then, but I don't think it is good for you now.

As for your question, some of those old functions indeed ignored ROI even if it is was defined. I am not sure but it is possible that cvCalcHist was one of them. New image format of OpenCV (called Mat) don't even has such field as ROI. Instead you can define partial images in convenient way that has same function as ROI (and of course witout memory). memory copy). Your code will look like:

Mat whole_image = imread(image_name);
Rect ROI;
...
Mat part_of_image(whole_image, ROI);


And then you provide part_of_image to calcHist and do the rest of the job.

Here you can read more about interface of calcHist and see example of its use.

I am not sure that "Learning OpenCV" is a good book for novice, because it is quite outdated. It was writen for OpenCV 1.0. OpenCV 2.4.3 was reased few days ago. OpenCV 1.0 had very difficult non-intuitive inteface, one of the issues that was fixed in OpenCV 2. And so you are learning how to do things in a complicate way and use functions some of which are already depricated. Don't take it wrong, this is a very good book that was very helpful back then, but I don't think it is good for you now.

As for your question, some of those old functions indeed ignored ROI even if it is was defined. I am not sure but it is possible that cvCalcHist was one of them. New image format of OpenCV (called Mat) don't even has such field as ROI. Instead you can define partial images in convenient way that has same function as ROI (and of course witout without memory copy). Your code will look like:

Mat whole_image = imread(image_name);
Rect ROI;
...
Mat part_of_image(whole_image, ROI);


And then you provide part_of_image to calcHist and do the rest of the job.

Here you can read more about interface of calcHist and see example of its use.