Add column for Mat Javacv

8 views
Skip to first unread message

shira Jacobs

unread,
Nov 14, 2022, 4:36:56 PM11/14/22
to javacv

Hi friends,

 

I'm working on comparing 2 images,

 And sometimes the images or not equal in size. What breaks the comparation.

For that I tried a code that checks the max Row and col and adds it to the lake image something like this :

 

MatmSize=newMat(Math.max(base.rows(),cur.rows()),Math.max(base.cols(),cur.cols()));

intgapRows=mSize.rows()-base.rows();

intgapCols=mSize.cols()-base.cols();

if(gapRows>0){

base.resize(gapRows,newScalar(0,0,0,1));

}

else{

current.resize(gapRows,newScalar(0,0,0,1));

}

if(gapCols>0){

 

}

else{

 

}

Now I cannot find a way for adding a column, any help??

Or is another simpler idea for solving the size issue?

hope Im clear enough....  

Thanks in advance!

Samuel Audet

unread,
Nov 14, 2022, 6:38:30 PM11/14/22
to jav...@googlegroups.com, shira Jacobs
The easiest way to do that is probably with copyMakeBorder():
https://docs.opencv.org/4.x/dc/da3/tutorial_copyMakeBorder.html

shira Jacobs

unread,
Nov 16, 2022, 1:38:27 AM11/16/22
to javacv
Thanks Samuel! 
That works correctlly!

ב-יום שלישי, 15 בנובמבר 2022 בשעה 01:38:30 UTC+2, Samuel Audet כתב/ה:
Reply all
Reply to author
Forward
0 new messages