【发布时间】:2018-07-01 20:22:49
【问题描述】:
我需要从 Java 代码中调用这个 MATLAB 代码。该代码根据指定的聚类数量和指定的初始聚类中心(即本代码中的 [176;137])对图像进行聚类。
nrows = size(a_image,1);
ncols = size(a_image,2);
double_a_2_image = double(reshape(a_image,nrows*ncols,1));
nColors = 2;
[cluster_idx_2_a cluster_center] =
kmeans(double_a_2_image,nColors,'distance','sqEuclidean','start',repmat([176;137],
[1,1,3]));
a_pixel_labels_2 = reshape(cluster_idx_2_a,nrows,ncols);
figure('Name','a* image labeled by cluster index: 2 colors'),imshow(a_pixel_labels_2,
[]);
将此代码转换为 jar 文件(或者可能是 .class 文件)的最佳工具是什么?还有一点:我需要在没有安装 matlab 的机器上运行生成的 jar 文件。这可能还是我应该在这台机器上安装 MATLAB Compiler Runtime (MCR)?
【问题讨论】: