Examples of Matlab to OpenCV conversions

后端 未结 1 522
一个人的身影
一个人的身影 2021-01-30 18:51

From time to time I have to port some Matlab Code to OpenCV.

Almost always there is a way to do it and an appropriate function in OpenCV. Nevertheless its not always ea

相关标签:
1条回答
  • 2021-01-30 19:38

    Repmat

    Replicate and tile an array. B = repmat(A,M,N) creates a large matrix B consisting of an M-by-N tiling of copies of A. The size of B is [size(A,1)*M, size(A,2)*N]. The statement repmat(A,N) creates an N-by-N tiling.

    B = repeat(A, M, N)

    OpenCV Docs

    Find

    Find indices of nonzero elements. I = find(X) returns the linear indices corresponding to the nonzero entries of the array X. X may be a logical expression. Use IND2SUB(SIZE(X),I) to calculate multiple subscripts from the linear indices I.

    Similar to Matlab's find

    Conv2

    Two dimensional convolution. C = conv2(A, B) performs the 2-D convolution of matrices A and B. If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]).

    Similar to Conv2

    Imagesc

    Scale data and display as image. imagesc(...) is the same as IMAGE(...) except the data is scaled to use the full colormap.

    SO Imagesc

    Imfilter

    N-D filtering of multidimensional images. B = imfilter(A,H) filters the multidimensional array A with the multidimensional filter H. A can be logical or it can be a nonsparse numeric array of any class and dimension. The result, B, has the same size and class as A.

    SO Imfilter

    Imregionalmax

    Regional maxima. BW = imregionalmax(I) computes the regional maxima of I. imregionalmax returns a binary image, BW, the same size as I, that identifies the locations of the regional maxima in I. In BW, pixels that are set to 1 identify regional maxima; all other pixels are set to 0.

    SO Imregionalmax

    Ordfilt2

    2-D order-statistic filtering. B=ordfilt2(A,ORDER,DOMAIN) replaces each element in A by the ORDER-th element in the sorted set of neighbors specified by the nonzero elements in DOMAIN.

    SO Ordfilt2

    Roipoly

    Select polygonal region of interest. Use roipoly to select a polygonal region of interest within an image. roipoly returns a binary image that you can use as a mask for masked filtering.

    SO Roipoly

    Gradient

    Approximate gradient. [FX,FY] = gradient(F) returns the numerical gradient of the matrix F. FX corresponds to dF/dx, the differences in x (horizontal) direction. FY corresponds to dF/dy, the differences in y (vertical) direction. The spacing between points in each direction is assumed to be one. When F is a vector, DF = gradient(F)is the 1-D gradient.

    SO Gradient

    Sub2Ind

    Linear index from multiple subscripts. sub2ind is used to determine the equivalent single index corresponding to a given set of subscript values.

    SO sub2ind

    backslash operator or mldivide

    solves the system of linear equations A*x = B. The matrices A and B must have the same number of rows.

    cv::solve

    0 讨论(0)
提交回复
热议问题