Ask Your Question
0

which functions should I use to convert matlab into opencv code?

asked 2016-11-12 07:37:14 -0600

buyi1128 gravatar image

updated 2016-11-25 00:21:33 -0600

Hi, I need to convert matlab code into c++ code. I decide to use opencv to deal with the functionality of imagine processing. In my matlab code, I use the functions below to draw images.

           figure();
            subplot();
            imagesc();
            colormap()); 
            caxis();
            ylim
            xlim
            xlabel
            ylabel

Could anyone tell me which functions in opencv I should learn or use? thank you.

The first picture is what I get in Matlab, and I want get the similar result using opencv. All the data structures have been done. And the second picture is the code of using opencv to replace function imagesc, but I couldn't get result. I am a new learner to opencv, Could anyone help me solve this problem? Thank you. image description image description

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-11-12 09:54:51 -0600

berak gravatar image

well, colormap at least has a corresponding applyColorMap()

for the rest of it : you simply cannot translate matlab code to c++, or opencv code line-by-line.

there's a plot module in opencv_contrib, there are drawing functions and imshow()

-- just don't expect, that anyone there even vaguely tries to copy matlab interfaces.

edit flag offensive delete link more

Comments

Thank you for your answer. I also want to know which function could replace the function of imagesc. This function is important for conversion. And my parameter of imagesc is a [1933x362 double] matrix.

buyi1128 gravatar imagebuyi1128 ( 2016-11-12 20:06:02 -0600 )edit

I think @berak was not clear enough. Trying to translate code exactly from matlab to OpenCV will never work. You can translate concepts, but both frameworks are so different in accessing data and such ...

StevenPuttemans gravatar imageStevenPuttemans ( 2016-11-14 06:19:52 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-11-12 07:37:14 -0600

Seen: 434 times

Last updated: Nov 25 '16