Ask Your Question

Replicate with mask in Opencv

asked 2013-09-16 08:29:48 -0600

itay gravatar image

updated 2013-09-17 02:09:45 -0600


I would like to know if there is a way to do a replicate with Mask?

it should do it like this code in matlab:

imfilter(currGray , [-1 1] , 'same' , 'replicate')

Thanks for help.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-09-30 01:01:44 -0600

itay gravatar image

updated 2013-09-30 01:04:55 -0600

Ok, Ifound the answer:

The function who solved my issue is - Imgproc.filter2D

and i used it like this -

Imgproc.filter2D(Framesarray[i], TempmGray1, CvType.CV_32FC1, kernel, anchor, 0, Imgproc.BORDER_REPLICATE);


The kernel is the "mask" that i want to move in the convolution and the "anchor" is the middle of this matrix. CvType.CV_32FC1 means that the values inside the result matrix could be also negative, and "BORDER_REPLICATE" just fill the edge with zeroes.

that's it.

edit flag offensive delete link more

answered 2013-09-17 06:42:17 -0600

Look at MatLab Multidimensional image filtering

You can certainly found similar function in opencv doc there : OpenCV Image Filtering

edit flag offensive delete link more


I saw both of this sites, but nothing there solve my problem, now i'm trying to implement it by my self, but i found the it's not so easy to work with matrix in java opencv, Matlab is much much easier.

itay gravatar imageitay ( 2013-09-17 07:04:01 -0600 )edit

Question Tools


Asked: 2013-09-16 08:29:48 -0600

Seen: 643 times

Last updated: Sep 30 '13