2019-02-12 03:46:48 -0600 | received badge | ● Popular Question (source) |
2013-11-18 05:52:25 -0600 | received badge | ● Editor (source) |
2013-11-18 05:51:33 -0600 | asked a question | How to get values of a Matrix which are non zero I am translating some matlab code to c++ using opencv. I want to get the values of a Matrix which satisfies a condition. I created a mask for this and when I apply it to the original Matrix I get the same size of the original matrix but with 0 values which are not there in the mask. But my question is how can I get only the values that are non-zero in the matrix and assign it to a different matrix. My matlab code is: The c++ translation that I have now is: So, how can I create a matrix which only has the values that the mask satisfies??? |
2013-09-04 10:21:39 -0600 | asked a question | Sobel filter output from opencv and Matlab different I am converting some code from matlab to opencv. I tried to use Sobel in opencv but the output of opencv and matlab is completely different what could be the reason. How can I make the ouput of opencv same as matlab? My MATLAB code is : where 0.03 is the threshold. In opencv when I use the prebuilt Sobel filter the output is completely different that of matlab even the engle and magnitude calculated in openc vis different. The opencv code is: The sobel edge itself is different and the magnitude and angle too, I tried to convert manually too the sobel in opencv by looking at the edge function in matlab but still the output is different because it turns out the filter2D of opencv and imfilter in matlab returns different output. How can I obtain the same output of sobel in matlab and opencv???The code of manually converting sobel of matlab to opencv is: |