会水的大圣 2021-03-16 16:28 采纳率: 0%
浏览 68

JAVA中调用MATLAB生成得jar包,编译错误,请问要如何解决

1.遇到的问题:从MATLAB中导出jar包,然后导入java中调用,该jar包的功能为对一个图像集进行拼接,其中使用了vlfeat这一插件,报错如下

2.MATLAB及JAVA源码:

function []=stitch_func(res,des)
     path=res;

    %% params
    focus=1000;
    Full360=0;
    unordered=0;
    size_bound=400.0;

    %%
    full=Full360;
    f=focus;
    run('lib/vlfeat-0.9.20/toolbox/vl_setup'); %在这一行出错,这一行应该是使vlfeat这个插件运行起来
    disp(['creating panorama for ',res]);  
    s=imageSet(fullfile(path));                %创建一个imageSet对象
    img=read(s,1);                             %读取图像集合里的第一张图像
    size_1=size(img,1);
    if size_1>size_bound
        img=imresize(img,size_bound/size_1);
    end
    imgs=zeros(size(img,1),size(img,2),size(img,3),s.Count,'like',img);
    t=cputime;
    for i=1:s.Count
        new_img=read(s,i);
        if size_1>size_bound
            imgs(:,:,:,i)=imresize(new_img,size_bound/size_1);
        else
            imgs(:,:,:,i)=new_img;
        end
        
    end
    disp(['resizing:',int2str(cputime-t),' sec']);

    if unordered     %若图像无序,对图像库中的图像进行排序
        t=cputime;
        disp('ordering unordered images');
        imgs=imorder(imgs);
        disp([int2str(cputime-t),' sec']);
    end

    panorama=create( imgs, f, full);
    imwrite(panorama,[des,'.jpg']);
    if unordered
        imwrite(panorama,[des,'from unordered.jpg']);
    end
package stitch;

import com.mathworks.toolbox.javabuilder.*;
import stitch_func.Stitcher;   //此为MATLAB调用的函数的类

public class StitchTest {
    public static void main(String[] args) {
        try {
            Stitcher stitch = new Stitcher();
            stitch.stitch_func("D:\\Work\\program\\pictures\\picture_dehaze\\",
                    "D:\\Work\\program\\pictures\\picture_stitch\\");//参数为(图像集地址,拼接图像保存地址)
        } catch (MWException e) {
            e.printStackTrace();
        }
    }
}

3.问题补充:此代码在MATLAB上可以正常运行;在打包的时候界面如下

  • 写回答

1条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2022-09-07 17:51
    关注
    不知道你这个问题是否已经解决, 如果还没有解决的话:

    如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 以帮助更多的人 ^-^
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题