cv::MatExpr evaluates expression when we perform task/compare rather then when we evaluate (Bug #1816)


Added by Rudra Poudel almost 13 years ago. Updated almost 13 years ago.


Status:Cancelled Start date:2012-04-17
Priority:Low Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:core
Target version:2.4.1
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

cv::MatExpr evaluates expression when we perform task/compare rather then when we actually evaluate the expression,

Example,

cv::Mat depth_map(VIDEO_FRAME_HEIGHT, VIDEO_FRAME_WIDTH, CV_8UC1, 1);
cv::Mat dist_trans(VIDEO_FRAME_HEIGHT, VIDEO_FRAME_WIDTH, CV_32FC1);
cv::circle(depth_map, cv::Point2i(320, 240), 40, cvScalar(255,255,255), 10);
cv::MatExpr mask_fg = depth_map > 1;
cv::MatExpr mask_bg = depth_map <= 1;
depth_map.setTo(0, mask_fg);
depth_map.setTo(255, mask_bg);
double min_value, max_value;
cv::minMaxLoc(depth_map, &min_value, &max_value);
std::cout<<"\nmin_value: "<<min_value<<"\tmax_value: "<<max_value; //Output: min_value: 255 max_value: 255

I am not sure if that is desire behavior, however I feel odd even if that is desire behavior.


Associated revisions

Revision 95006af1
Added by Roman Donchenko over 11 years ago

Merge pull request #1816 from SpecLad:no-more-epoch

History

Updated by Andrey Kamaev almost 13 years ago

  • Priority changed from Blocker to Low
  • Category set to core

Updated by Vadim Pisarevsky almost 13 years ago

MatExpr is a proxy class. It should not be used explicitly.

replace

cv::MatExpr mask_fg = depth_map > 1;
cv::MatExpr mask_bg = depth_map <= 1;

with

cv::Mat mask_fg = depth_map > 1;
cv::Mat mask_bg = depth_map <= 1;

and it will work as expected

  • Status changed from Open to Cancelled
  • Assignee set to Vadim Pisarevsky

Updated by Andrey Kamaev almost 13 years ago

  • Target version set to 2.4.1

Also available in: Atom PDF