Skip to content

Commit

Permalink
Improved conversion to mxLOGICAL_CLASS mxarray
Browse files Browse the repository at this point in the history
  • Loading branch information
kyamagu committed Sep 4, 2012
1 parent a71f045 commit 8e324af
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/MxArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ MxArray::MxArray(const cv::Mat& mat, mxClassID classid, bool transpose)
std::swap(d[0], d[1]);
if (classid == mxLOGICAL_CLASS) {
// OpenCV's logical true is any nonzero while matlab's true is 1
threshold(input, input, 0, 1, cv::THRESH_BINARY);
cv::compare(input, 0, input, cv::CMP_NE);
input.setTo(1, input);
p_ = mxCreateLogicalArray(d.size(), &d[0]);
}
else {
Expand Down

0 comments on commit 8e324af

Please sign in to comment.