# How to convert matlab code in Java??

• November 2nd, 2013, 10:46 AM
Mumpy Zinu
How to convert matlab code in Java??
I have matlab code and i have to convert this code in java.I dont know how to do this.Can you help me please??? here is my Matlab code

clc;
clear all;
close all;
I=imcrop(I);
I=rgb2gray(I);
I=im2double(I);
sigma = 20/255;
y = I + sigma*randn(size(I));
%-------------------------------------------------NON LOCAL MEANS
S = 10;
P = 3;
h = 10 * sigma;
% xx is denoised image
xx=nonLocalMean(y,h,P,S);
h = fspecial('gaussian',[5 5],1.9);
G=conv2(N,h,'same');
toc
PSNR_gaussian=PeakSignaltoNoiseRatio(I,G)
B=bfilter2(N,[5 5],[3 0.2]);
toc
PSNR_Bilateral=PeakSignaltoNoiseRatio(I,B)
PSNR_StandardNLM = PeakSignaltoNoiseRatio1(I,xx)
%PSNR_NLMMethodNoise=PeakSignaltoNoiseRatio1(I,Fin al)
%-------------------------------------------
figure,imshow(I),title('original')
figure,imshow(y),title('noisy')
figure,imshow(xx),title('Standard NLM')
figure,imshow(gg),title('Gaussian blurring')
figure,imshow(bb),title('Standard NLM')
%imwrite(xx,'z1.png');
• November 2nd, 2013, 11:48 PM
rodiongork
Re: How to convert matlab code in Java??
Oh, be sure you need to completely rewrite the stuff. And it would not be an easy matter - especially if you do not know one of the languages. Moreover you'll need to rewrite some math subroutines for java or find libraries for them.

So you'll better think thoroughly, whether you really need this to be rewritten.
• November 3rd, 2013, 09:14 AM
Mumpy Zinu
Re: How to convert matlab code in Java??
How to write Imread code in java???
• November 4th, 2013, 03:09 AM
rodiongork
Re: How to convert matlab code in Java??
Use ImageIO class.