# How to install matlab in julia and how to occupy it

**URL:** <https://discourse.julialang.org/t/how-to-install-matlab-in-julia-and-how-to-occupy-it/24994>\
**Category:** General Usage\
**Created:** [June 6, 2019, 8:02am UTC](https://discourse.julialang.org/t/how-to-install-matlab-in-julia-and-how-to-occupy-it/24994 "2019-06-06T08:02:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![GERSON\_EZEQUIEL\_HERN](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gerson_ezequiel_hern/32/7437_2.png) [@GERSON\_EZEQUIEL\_HERN](https://discourse.julialang.org/u/GERSON_EZEQUIEL_HERN)\
**Post date:** [June 6, 2019, 8:02am UTC](https://discourse.julialang.org/t/how-to-install-matlab-in-julia-and-how-to-occupy-it/24994/1 "2019-06-06T08:02:36Z")

</div>

I need Matlab in julia…

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [June 6, 2019, 8:05am UTC](https://discourse.julialang.org/t/how-to-install-matlab-in-julia-and-how-to-occupy-it/24994/2 "2019-06-06T08:05:30Z")

</div>

I am not sure I understand what you are trying to do, but perhaps you are looking for

> **[GitHub - JuliaInterop/MATLAB.jl: Calling MATLAB in Julia through MATLAB Engine](https://github.com/JuliaInterop/MATLAB.jl)**
>
> Calling MATLAB in Julia through MATLAB Engine. Contribute to JuliaInterop/MATLAB.jl development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![GERSON\_EZEQUIEL\_HERN](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gerson_ezequiel_hern/32/7437_2.png) [@GERSON\_EZEQUIEL\_HERN](https://discourse.julialang.org/u/GERSON_EZEQUIEL_HERN)\
**Post date:** [June 6, 2019, 8:08am UTC](https://discourse.julialang.org/t/how-to-install-matlab-in-julia-and-how-to-occupy-it/24994/3 "2019-06-06T08:08:32Z")

</div>

What I want to do is; How can I get the automatic Threshold of a july image?[Automatic threshold of an image in matlab.](https://www.mathworks.com/help/images/ref/graythresh.html)

---

<div class="post-metadata">

**Author:** ![GERSON\_EZEQUIEL\_HERN](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gerson_ezequiel_hern/32/7437_2.png) [@GERSON\_EZEQUIEL\_HERN](https://discourse.julialang.org/u/GERSON_EZEQUIEL_HERN)\
**Post date:** [June 6, 2019, 8:11am UTC](https://discourse.julialang.org/t/how-to-install-matlab-in-julia-and-how-to-occupy-it/24994/4 "2019-06-06T08:11:37Z")

</div>

my project …

using ImageContrastAdjustment, Images, ImageFiltering, TestImages, ColorTypes, HistogramThresholding  
const ICA = ImageContrastAdjustment

function example()

```
img = testimage("circulo")

# Grayscale image.
imgg = Gray.(img)

# Linear contrast stretching.
imggₗ = ICA.adjust_histogram(ICA.LinearStretching(), imgg)

# Histogram Equalization.
imggₑ = ICA.adjust_histogram(ICA.Equalization(), imgg)

#=
   admiminsion and subtracion
 =#
R₁ = float.(imggₗ) + float.(imggₑ)

R₂ = R₁ - float.(imggₑ)

# imggₗ + imggₗ + imggₑ.
R₃ = R₁ + R₂

# Applying a minimum filter.
window_size = (-1:1, -1:1)
imgmin = mapwindow(minimum, R₃, window_size)

# divide el intervalo del valor más pequeño al más grande en imgmin en 256 bin
edges, counts = ICA.build_histogram(imgmin, 256, minval = minimum(imgmin), maxval = maximum(imgmin))

#=
La matriz `count` almacena en el índice 0 las frecuencias que estaban por debajo de
  primer borde del cubo. Ya que estamos buscando un umbral sobre el intervalo
  divididos por `edges` necesitamos descartar la primera bandeja en` count`
  de modo que las dimensiones de `edge` y` count` coincidan.
=#
t = find_threshold(Otsu(), counts[1:end], edges)

# Aplica el umbral a imgmin y checo el resultado.
img₀₁ = zeros(Gray{Bool}, axes(imgmin))
for i in CartesianIndices(img)
    img₀₁[i] = imgmin[i] < t ? 0 : 1
end
display(img₀₁)

```

end

example()

the picture is

 ![20](https://global.discourse-cdn.com/julialang/original/3X/c/a/ca478e0495caaf417a655dec8770d1421c98f1be.jpeg)

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [June 6, 2019, 8:20am UTC](https://discourse.julialang.org/t/how-to-install-matlab-in-julia-and-how-to-occupy-it/24994/5 "2019-06-06T08:20:11Z")

</div>

It is still not clear what you are asking here.

The original question seems to be about something general (interfacing Matlab and Julia), the second one is about programming a specific problem in Julia.

I am not sure how the two are related, or why you need Matlab for this.

The method you link should be [very simple to implement](https://en.wikipedia.org/wiki/Otsu's_method) in Julia (if not done already, I didn’t check). Perhaps you could contribute it to one of the image processing libraries as a PR.

---

<div class="post-metadata">

**Author:** ![GERSON\_EZEQUIEL\_HERN](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gerson_ezequiel_hern/32/7437_2.png) [@GERSON\_EZEQUIEL\_HERN](https://discourse.julialang.org/u/GERSON_EZEQUIEL_HERN)\
**Post date:** [June 6, 2019, 8:25am UTC](https://discourse.julialang.org/t/how-to-install-matlab-in-julia-and-how-to-occupy-it/24994/6 "2019-06-06T08:25:18Z")

</div>

Excuse me if I did not make sense, I think I love the nights I have not slept.

The code you provide is made in Juno.

but I’ve been searching the internet for matlab in julia … and I found a process, and I thought it would be good to install matlab.

But my code does the opposite of what I require.

and I want to use the otsu method in that image. Through Julia-matlab. Or if not well, it would be in Julia, in console form.

---

<div class="post-metadata">

**Author:** ![tlienart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlienart/32/7640_2.png) [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Post date:** [June 6, 2019, 8:36am UTC](https://discourse.julialang.org/t/how-to-install-matlab-in-julia-and-how-to-occupy-it/24994/7 "2019-06-06T08:36:28Z")

</div>

Maybe this package: [https://github.com/zygmuntszpak/ImageBinarization.jl](https://github.com/zygmuntszpak/ImageBinarization.jl) is what you’re looking for for the binarisation; it does implement Otsu.

(If you really want to use Matlab, you’ll want to use the interop package mentioned already)
