Open sunitanyk opened 4 years ago
Can you share your test code? I was able to get this to compile under Windows and would like to try what you're trying. Looking at the example, the same function is called, so I can't understand why your test would be different from the sample.
@sunitanyk I tried the alphamat sample on Ubuntu 18.04 and Mac OS Catalina and output looks es expected for both cases. Images are attached. Could you provide version_string.tmp
from your build directory? Do you use the example to reproduce the issue?
Tried again with brew's opencv version 4.3.0_5 installation, and it works fine. Thanks.
@asmorkalov I tried the alphamat sample on Ubuntu 16.04 and opencv =>4.3.0,The module does not give right results while being called directly as an OpenCV function call: cv::alphamat::infoFlow (InputArray image, InputArray tmap, OutputArray result). Current Output from OpenCV4.3 function call : Expected Output:
@zongking123 Could you provide code to reproduce the issue and output of getBuildInformation call. Do you build OpenCV by your self?
I'v got the same result when using cv::alphamat::infoFlow.Here is my code:
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <opencv2/alphamat.hpp>
using namespace cv;
using namespace std;
int main(int argc, char** argv){
if(argc < 4){
printf("Please input your source file and mask file and output file,format:\n./convert input.png mask.png output.png\n");
return 0;
}
Mat source = imread(argv[1]);
Mat mask = imread(argv[2]);
Mat output = Mat::zeros(source.size(), source.type());
if(source.size().width!=mask.size().width || source.size().height!=mask.size().height) {
printf("Your mask file size not match your source file,the source file size is %d*%d,but the mask size is %d*%d.\n",
source.size().width,source.size().height,mask.size().width,mask.size().height);
return 0;
}
//Convert Mat to float data type
source.convertTo(source, CV_32FC3);
mask.convertTo(mask, CV_32FC3);
//main test method
cv::alphamat::infoFlow(source, mask, output);
//Display image
imwrite(argv[3], output);
printf("output: %s\n",argv[3]);
return 0;
}
I also encountered this problem. After make tmap
greyscale (8U3C to 8U1C), the output is correct.
System information (version)
Detailed description
There is a runtime issue while using the alphamat module in OpenCV4.3. It seems to be some resizing/cropping issue. Looks like only the top right of the input image is being processed.
The module works fine offline with the included example code, but does not give right results while being called directly as an OpenCV function call: cv::alphamat::infoFlow (InputArray image, InputArray tmap, OutputArray result) using OpenCV4.3 installation.
Input Images(RGB and trimap):
Expected Output(as is obtained from testing the module code offline)
Current Output from OpenCV4.3 function call :
This looks somewhat similar to images reported in an earlier issue( dynamic fusion running error! #2521)