shaileshmulange / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

Blender blend(CvArr, CvArr) does not return results #272

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1- Execute this pseudo-code

CvSize sizes = new CvSize(imageN.size());
MatVector images = new MatVector(imageN.size());
for(...){
   IplImage image = cvLoadImage(imageN);
   images.put(index,image);
   sizes.position(index).put(image.cvSize());
}
CvPoint corners = CvPoint(imageN.size()));
Blender blender = Blender.createDefault(Blender.FEATHER, false);
corners.position(0);
sizes.position(0);
blender.prepare(corners, sizes);
for(...){
    image_s = convertTo16s(images.getCvMat(index));
    blender.feed(image_s, dummy_mask_mat, corners.position(index);
}
IplImage result = new IplImage(null);
IplImage resultMask = new IplImage(null);
blender.blend(result, resultMask)

What is the expected output? What do you see instead?
result and resultMask should contain blended image and blended mask 
respectively. Blending does not provide any output.

What version of the product are you using? On what operating system?
0.3  Windows 8 64-bit

Please provide any additional information below.
C/C++ equivalent function of the Blender::blend function takes parameters as 
destination matrices however JavaCv interface of the native function specifies 
parameters as Input matrices by annotations. As a result blend function cannot 
return the expected results. The reason I thought that is no matter how I 
initialize result matrices they stay same after the blend function. If I assign 
directly null to them they seem to stay null after the blend, if I assign a 
per-build matrix they again stays same with the initial values. I don't provide 
specific mask matrix or the corner values for the sake of short and clear code 
and I don't think they are related to the problem however if they are required 
I can provide more detailed code.

Original issue reported on code.google.com by kaan...@gmail.com on 17 Jan 2013 at 1:26

GoogleCodeExporter commented 9 years ago
You're right. This change should fix that:
-        public native void blend(@InputMat CvArr dst, @InputMat CvArr 
dst_mask);
+        public native void blend(@OutputMat IplImage dst, @OutputMat IplImage 
dst_mask);
Any other functions like that that I missed? Thanks for reporting!

Original comment by samuel.a...@gmail.com on 19 Jan 2013 at 8:59

GoogleCodeExporter commented 9 years ago
FYI, I've made the change in this revision:
http://code.google.com/p/javacv/source/detail?r=ce6c88e751053a06b1deb4e65f2490b5
fe2694b0

Original comment by samuel.a...@gmail.com on 26 Jan 2013 at 9:23

GoogleCodeExporter commented 9 years ago
Fix included in latest version (JavaCV 0.4), thanks for reporting!

Original comment by samuel.a...@gmail.com on 3 Mar 2013 at 12:21

GoogleCodeExporter commented 9 years ago
Thanks for the fix.

Original comment by kaan...@gmail.com on 18 Mar 2013 at 7:46