Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我在Java项目中构建了一个matlab代码,现在运行调用matlab函数的Java代码行时出现错误_Java_Matlab_Image Processing_Matlab Deployment_Matlab Compiler - Fatal编程技术网

我在Java项目中构建了一个matlab代码,现在运行调用matlab函数的Java代码行时出现错误

我在Java项目中构建了一个matlab代码,现在运行调用matlab函数的Java代码行时出现错误,java,matlab,image-processing,matlab-deployment,matlab-compiler,Java,Matlab,Image Processing,Matlab Deployment,Matlab Compiler,我的matlab代码做图像处理,我制作了matlab函数,其中有两幅图像作为输入。我编写了一个单独的java类来执行matlab的imread功能,即将jpg图像读入3D数组(它是一个RGB图像) 你能告诉我如何修复这个错误吗?这是我的java代码的问题,还是matlab代码的导入问题?我对Java非常陌生,所以我无法解决这个问题。谢谢 根据您的评论,您已经定义了一个方法encoder\u函数(List,List),该函数使用两个Lists作为参数。您试图用一些非Lists的参数调用它,这就是编

我的matlab代码做图像处理,我制作了matlab函数,其中有两幅图像作为输入。我编写了一个单独的java类来执行matlab的imread功能,即将jpg图像读入3D数组(它是一个RGB图像)


你能告诉我如何修复这个错误吗?这是我的java代码的问题,还是matlab代码的导入问题?我对Java非常陌生,所以我无法解决这个问题。谢谢

根据您的评论,您已经定义了一个方法
encoder\u函数(List,List)
,该函数使用两个
List
s作为参数。您试图用一些非
List
s的参数调用它,这就是编译器抱怨的原因

要解决此问题,您必须:

  • 更改
    encoder\u函数(List,List)
    定义,将
    条形码图像类
    原始照片类
    作为参数,并相应地更新方法的代码

  • 找到一种将
    barcode\u image\u class
    原始照片\u class
    转换为
    列表
    (通过实现
    列表
    界面或在这两个类中提供一些帮助方法,将它们转换为
    列表

完全暗中捅:如果在调用
Arrays.asList
,即x.encoder\u函数(Arrays.asList(barcode),Arrays.asList(original_photo));
时将参数包装到
x.encoder\u函数中,会有帮助吗?(您需要导入java.util.Arrays;`。)谢谢Luke!这段代码消除了错误!但是现在我发现MatlabJava接口有一些问题:线程“main”中出现异常java.lang.UnsatisfiedLinkError:未能在java.library.path上找到MATLAB Builder JA所需的库mclmcrrt7_15.dll。此库通常与MATLAB或MCR一起安装,如果没有,则可能表明该安装或当前路径配置存在问题。此组件尝试使用的MCR版本为:7.15。我将系统设置中的路径更改为…\Files\Java\jdk1.6.0\u 33\bin,但由于我安装了Java版本7,因此它没有使用版本6。问题是matlab正在连接到版本6,因此存在不兼容。我如何解决此问题?
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import QRcode_java.*;
import com.mathworks.toolbox.javabuilder.*;


public class Driver {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        encoder_class x=null;     //encoder_class is the class built from the  
                                        //matlab function                         

        Object[] barcode2=null;         //output of matlab function
        barcode_image_class barcode;     //class to imread the jpg image input
        barcode= new barcode_image_class();
        original_photo_class original_photo;  
             //class to imread another image input
        original_photo= new original_photo_class();

        try {
            x= new encoder_class();
            barcode2=x.encoder_function(barcode, original_photo); 
//**ERROR!** /*encoder_function is the matlab function written by me. this line gives an //error as the following: 
//"The method encoder_function(List, List) in the type encoder_class 
//is not applicable for the arguments (barcode_image_class, original_photo_class)"*/

        } catch (MWException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}