cv::exp error with single column matrix (Bug #2443)


Added by nemerle - over 12 years ago. Updated over 12 years ago.


Status:Done Start date:2012-10-16
Priority:Normal Due date:
Assignee:Vadim Pisarevsky % Done:

100%

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

Description

On git master branch, when using exp on cv::Mat1f(4,1) I'm getting the following error:

OpenCV Error: Bad argument (When the input arrays in add/subtract/multiply/divide functions have different types, the output array type must be explicitly specified) in arithm_op, file /home/nemerle/dev/Libraries/opencv_git/modules/core/src/arithm.cpp, line 1300

test code:
#include <stdio.h>
#include <opencv2/core/core.hpp>
#include <opencv2/core/mat.hpp>
#include <opencv2/core/operations.hpp>
int main(int argc,char **argv)
{
    printf("Start\n");
    cv::Mat1f tt=cv::Mat1f::ones(4,2);
    cv::Mat1f outs;
    cv::exp(-tt,outs);
    fflush(stdout);
    printf("Step 2\n");
    fflush(stdout);
    cv::Mat1f tt2=cv::Mat1f::ones(4,1);
    cv::Mat1f outs2;
    cv::exp(-tt2,outs2); // fails
    printf("Done\n");
    return 0;    
}


Issue hierarchy

Bug #2443: cv::exp error with single column matrixDoneVadim Pisarevsky

Bug #2447: Unary - operator bug for single column matrixDoneVadim Pisarevsky


Associated revisions

Revision f351540e
Added by Roman Donchenko about 11 years ago

Merge pull request #2443 from waveform80:issue-3554

History

Updated by Daniil Osokin over 12 years ago

Hi! It looks like here are no bugs. I'm think you should explicitly specify the output array outs2 (outs2(4,1)). Please, ask this issue at OpenCV Q&A site: http://answers.opencv.org/questions/.

  • Assignee changed from Vadim Pisarevsky to nemerle -
  • Status changed from Open to Cancelled

Updated by nemerle - over 12 years ago

It's not a problem with output array size, but with unary - operator
I get the same error with this code

#include <stdio.h>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/core/mat.hpp>
#include <opencv2/core/operations.hpp>

int main(int argc,char **argv)
{
    cv::Mat1f tt2=cv::Mat1f::ones(4,1);
    std::cout<< -tt2;
    return 0;    
}

Updated by Daniil Osokin over 12 years ago

  • Assignee changed from nemerle - to Vadim Pisarevsky
  • Status changed from Cancelled to Open

Updated by Daniil Osokin over 12 years ago

  • Start date changed from 2012-10-15 to 2012-10-16

Updated by Vadim Pisarevsky over 12 years ago

  • % Done changed from 0 to 100

Updated by Vadim Pisarevsky over 12 years ago

  • Target version changed from 3.0 to 2.4.3
  • Status changed from Open to Done

Also available in: Atom PDF