Ask Your Question
1

Replicate with mask in Opencv

asked Sep 16 '13

itay gravatar image

updated Sep 17 '13

Hi,

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.

Preview: (hide)

2 answers

Sort by » oldest newest most voted
1

answered Sep 30 '13

itay gravatar image

updated Sep 30 '13

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);

explanation:

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.

Preview: (hide)
0

answered Sep 17 '13

Look at MatLab Multidimensional image filtering

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

Preview: (hide)

Comments

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 (Sep 17 '13)edit

Question Tools

Stats

Asked: Sep 16 '13

Seen: 687 times

Last updated: Sep 30 '13