Ask Your Question
0

How to concat Mat1's top half with Mat2's bottom half

asked 2018-10-26 04:56:53 -0500

updated 2018-10-26 05:02:00 -0500

berak gravatar image

Hi All,

Greeting.

I have a 2 mats, in opencv android

Mat1 = Mat(width,height,CvType.cv.8U); Mat2 = Mat(width,height,CvType.cv.8U);

I did submat on Mat1 & Mat2. Mat3 = Mat1.submat(0,height/2,0,width); Mat4 = Mat2.submat(height/2,height,0,width);

Created Array list Mat5 to hold Mat3 & Mat4.

When i Tried vconcat(Mat5,DstMat); i am getting Assertion failed error. Please tell me whether the approach i did was correct or any thing anything went wrong.

Thanks in Advance.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2018-10-28 10:01:11 -0500

@berak. Sorry for not sharing the code. i figured it by my self. On Mat2 I have done Imgprog to convert inputFrames to RGB. On Mat3 I have done Imgprog to convert inputFrames to Gray. When i concat both different converted color it thrown error.

Now i made both to same color(i.e RGB). It worked. So while doing concat, if there were any imgprog on any mat, the same should be on the other mat.

Thanks for your time in spending time on this query.

Cheers :)

edit flag offensive delete link more

Comments

solved, then ;)

berak gravatar imageberak ( 2018-10-28 10:22:19 -0500 )edit
0

answered 2018-10-26 05:04:24 -0500

berak gravatar image

updated 2018-10-26 05:22:16 -0500

take a look at the docs, vconcat and hconcat need a list of mats as 1st arg (in java)

also:

Mat(h,w,type);
edit flag offensive delete link more

Comments

Thanks for your swift reply. In the above Mat5 is array of list. it holds Mat3 and Mat4. I am aware of using it. When i concat submat of same Mat(say for example mat2 alone) i am not facing any issue. But when i use two different mat (here it is Mat2 and Mat1), i am getting error.

BALAKRISHANAN NAGARAJAN gravatar imageBALAKRISHANAN NAGARAJAN ( 2018-10-26 05:13:09 -0500 )edit

sorry, but you have to be more concise. when you do what, exactly, you get which error ?

berak gravatar imageberak ( 2018-10-26 05:23:16 -0500 )edit

No prob :). Hope now you understood my problem. Any guess on resolution please.

BALAKRISHANAN NAGARAJAN gravatar imageBALAKRISHANAN NAGARAJAN ( 2018-10-26 05:25:08 -0500 )edit

for vconcat, both Mat's need the same width, for hconcat the same height

berak gravatar imageberak ( 2018-10-26 05:33:32 -0500 )edit

Here both the Mat's width remains same as it is vconcat. I didnt make any mistake on that.

BALAKRISHANAN NAGARAJAN gravatar imageBALAKRISHANAN NAGARAJAN ( 2018-10-26 05:37:44 -0500 )edit
1

can you do is a favour, and edit your question, and put the exact code you're using, and the exact error , please ?

berak gravatar imageberak ( 2018-10-26 05:40:34 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-10-26 04:56:53 -0500

Seen: 52 times

Last updated: Oct 28 '18