Re: [julia-users] b images

2016-09-06 Thread Emerson Vitor Castelani
Ok!! That's work! Thank you for your help!!!

Emerson

Em terça-feira, 6 de setembro de 2016 13:26:47 UTC-3, El suisse escreveu:
>
> yeah sorry for the noise read fast your question . If you want a Binary 
> Image given a thresold value:
> img_bin = img_gray .<= value
> ​
>
> 2016-09-06 13:12 GMT-03:00 Emerson Vitor Castelani <emerso...@gmail.com 
> >:
>
>> Hi El suisse ! Thank you for your help. I already tried that. But in 
>> this case, we obtain a gray scaled image...I want a binary image...
>>
>> Em terça-feira, 6 de setembro de 2016 11:39:31 UTC-3, El suisse escreveu:
>>>
>>> I think with:
>>> img = load("path/to/your/image")
>>> img_bw = convert(Image{ColorTypes.Gray}, img)
>>> ​
>>>
>>> 2016-09-06 9:46 GMT-03:00 Emerson Vitor Castelani <emerso...@gmail.com>:
>>>
>>>> Is there any way to convert a jpg (or png) image in b using 
>>>> Images.jl? 
>>>>
>>>> Thanks
>>>>
>>>
>>>
>

Re: [julia-users] b images

2016-09-06 Thread Emerson Vitor Castelani
Hi El suisse ! Thank you for your help. I already tried that. But in this 
case, we obtain a gray scaled image...I want a binary image...

Em terça-feira, 6 de setembro de 2016 11:39:31 UTC-3, El suisse escreveu:
>
> I think with:
> img = load("path/to/your/image")
> img_bw = convert(Image{ColorTypes.Gray}, img)
> ​
>
> 2016-09-06 9:46 GMT-03:00 Emerson Vitor Castelani <emerso...@gmail.com 
> >:
>
>> Is there any way to convert a jpg (or png) image in b using Images.jl? 
>>
>> Thanks
>>
>
>

[julia-users] b images

2016-09-06 Thread Emerson Vitor Castelani
Is there any way to convert a jpg (or png) image in b using Images.jl? 

Thanks


[julia-users] Escher problem

2015-08-11 Thread Emerson Vitor Castelani
I am trying run Escher's examples but I had some problems. For example, in 
minesweeper.jl, is showed just the word minesweeper and nothing more...

Someone knows why?


Re: [julia-users] mouse event

2015-07-23 Thread Emerson Vitor Castelani
In the first moment I would like to click and get the coordinates of the 
point. Next, draw a (small) circle representing this point.


Em quinta-feira, 23 de julho de 2015 05:55:16 UTC-3, Andreas Lobinger 
escreveu:

 Can you describe, what you want to do?




Re: [julia-users] mouse event

2015-07-22 Thread Emerson Vitor Castelani
Do you recommend another way to get mouse events (without using pyplot)?

Em quarta-feira, 22 de julho de 2015 14:40:53 UTC-3, Isaiah escreveu:

 Ok, this appears to be a known limitation right now.
 https://github.com/stevengj/PyPlot.jl/issues/21

 On Wed, Jul 22, 2015 at 1:28 PM, Emerson Vitor Castelani 
 emerso...@gmail.com javascript: wrote:

 Code:

 using PyPlot
 using PyCall
 @pyimport matplotlib as plt
 fig = plt.gcf()
 function onclick(event)
 println(down, event) 
 end
 cid_up=fig[:canvas][:mpl_connect](button_press_event,onclick)
 plot.show()


 Error:

 PyError (:PyObject_Call) type 'exceptions.TypeError'
 TypeError(cannot create weak reference to 'PyCall.jl_Function' object,)
   File /usr/lib64/python2.7/site-packages/matplotlib/backend_bases.py, 
 line 2316, in mpl_connect
 return self.callbacks.connect(s, func)
   File /usr/lib64/python2.7/site-packages/matplotlib/cbook.py, line 506, 
 in connect
 self._func_cid_map[s][func] = cid
   File /usr/lib64/python2.7/weakref.py, line 321, in __setitem__
 self.data[ref(key, self._remove)] = value

 while loading In[5], in expression starting on line 1

  in pyerr_check at /home/emerson/.julia/v0.3/PyCall/src/exception.jl:60
  in pycall at /home/emerson/.julia/v0.3/PyCall/src/PyCall.jl:92
  in fn at /home/emerson/.julia/v0.3/PyCall/src/conversions.jl:188



 Thanks

 Em terça-feira, 21 de julho de 2015 16:23:30 UTC-3, Isaiah escreveu:

 Please describe what you tried and what was the error. You may need to 
 either 1) yield the event loop 2) make sure the program stays open long 
 enough to actually display your plot (ref: 
 https://github.com/stevengj/PyPlot.jl/issues/41)

 On Tue, Jul 21, 2015 at 2:53 PM, Emerson Vitor Castelani 
 emerso...@gmail.com wrote:

 I had a similar problem...I don't know why...


 Em terça-feira, 21 de julho de 2015 14:46:41 UTC-3, El suisse escreveu:

 Hi 
 I got the following example related with this thread

 https://gist.github.com/elsuizo/5338605a6a5c7ab54730

 but fail in


 https://gist.github.com/elsuizo/5338605a6a5c7ab54730#file-phase_portrait_mouse_event-jl-L114

 and I do not know why

 This is the python code which comes:

 https://gist.github.com/elsuizo/6957889d8e63e9029377





Re: [julia-users] mouse event

2015-07-22 Thread Emerson Vitor Castelani
Code:

using PyPlot
using PyCall
@pyimport matplotlib as plt
fig = plt.gcf()
function onclick(event)
println(down, event) 
end
cid_up=fig[:canvas][:mpl_connect](button_press_event,onclick)
plot.show()


Error:

PyError (:PyObject_Call) type 'exceptions.TypeError'
TypeError(cannot create weak reference to 'PyCall.jl_Function' object,)
  File /usr/lib64/python2.7/site-packages/matplotlib/backend_bases.py, line 
2316, in mpl_connect
return self.callbacks.connect(s, func)
  File /usr/lib64/python2.7/site-packages/matplotlib/cbook.py, line 506, in 
connect
self._func_cid_map[s][func] = cid
  File /usr/lib64/python2.7/weakref.py, line 321, in __setitem__
self.data[ref(key, self._remove)] = value

while loading In[5], in expression starting on line 1

 in pyerr_check at /home/emerson/.julia/v0.3/PyCall/src/exception.jl:60
 in pycall at /home/emerson/.julia/v0.3/PyCall/src/PyCall.jl:92
 in fn at /home/emerson/.julia/v0.3/PyCall/src/conversions.jl:188



Thanks

Em terça-feira, 21 de julho de 2015 16:23:30 UTC-3, Isaiah escreveu:

 Please describe what you tried and what was the error. You may need to 
 either 1) yield the event loop 2) make sure the program stays open long 
 enough to actually display your plot (ref: 
 https://github.com/stevengj/PyPlot.jl/issues/41)

 On Tue, Jul 21, 2015 at 2:53 PM, Emerson Vitor Castelani 
 emerso...@gmail.com javascript: wrote:

 I had a similar problem...I don't know why...


 Em terça-feira, 21 de julho de 2015 14:46:41 UTC-3, El suisse escreveu:

 Hi 
 I got the following example related with this thread

 https://gist.github.com/elsuizo/5338605a6a5c7ab54730

 but fail in


 https://gist.github.com/elsuizo/5338605a6a5c7ab54730#file-phase_portrait_mouse_event-jl-L114

 and I do not know why

 This is the python code which comes:

 https://gist.github.com/elsuizo/6957889d8e63e9029377




[julia-users] mouse event

2015-07-21 Thread Emerson Vitor Castelani
Guys, I need to know if we can create mouse events using pyplot in Julia? 
And how?

Thanks


Re: [julia-users] mouse event

2015-07-21 Thread Emerson Vitor Castelani
Well, I already tried this , but I don't get to do work!Does canvas and 
mpl_connect work in Julia? 

Em terça-feira, 21 de julho de 2015 13:38:06 UTC-3, Isaiah escreveu:

 http://matplotlib.org/users/event_handling.html

 On Tue, Jul 21, 2015 at 12:34 PM, Emerson Vitor Castelani 
 emerso...@gmail.com javascript: wrote:

 Guys, I need to know if we can create mouse events using pyplot in Julia? 
 And how?

 Thanks




Re: [julia-users] mouse event

2015-07-21 Thread Emerson Vitor Castelani
I had a similar problem...I don't know why...

Em terça-feira, 21 de julho de 2015 14:46:41 UTC-3, El suisse escreveu:

 Hi 
 I got the following example related with this thread

 https://gist.github.com/elsuizo/5338605a6a5c7ab54730

 but fail in


 https://gist.github.com/elsuizo/5338605a6a5c7ab54730#file-phase_portrait_mouse_event-jl-L114

 and I do not know why

 This is the python code which comes:

 https://gist.github.com/elsuizo/6957889d8e63e9029377



Re: [julia-users] simplex in Julia is very slow

2014-11-28 Thread Emerson Vitor Castelani
Hi Stefan. I am very grateful by your attention. Each variable typed 
correctly doesn't change the perfomance. Do you have other suggestion to me?

Thanks,

-Emerson

Em quarta-feira, 26 de novembro de 2014 17h52min57s UTC-2, Stefan Karpinski 
escreveu:

 I wonder if \ might be type unstable.

 On Wed, Nov 26, 2014 at 2:49 PM, Stefan Karpinski ste...@karpinski.org 
 javascript: wrote:

 It turns out that doesn't actually matter but there are other unrelated 
 ill-typed variables in the code:

 Xb, o, y, r, e, Nj, ind, q, t


 I haven't determined why this is happening, but something is ill-typed 
 here.

 On Wed, Nov 26, 2014 at 1:20 PM, Tim Holy tim@gmail.com 
 javascript: wrote:

 Stefan's point is more relevant than you realize; if the type of the 
 variable
 is uncertain, the loop will be very slow. You can make that resize 
 operation a
 separate function, from which you call your main routine.

 --Tim

 On Wednesday, November 26, 2014 09:26:35 AM Emerson Vitor Castelani 
 wrote:
  Humm, It's useful but I guess that the problem is something in loop 
 while...
 
  Em quarta-feira, 26 de novembro de 2014 15h05min03s UTC-2, Stefan 
 Karpinski
 
  escreveu:
   I'm not sure if this is the problem, but changing the type of a 
 variable
   in a function body causes problems for type inference. For that 
 reason,
   the
   first two lines of this code may cause performance issue if you call 
 this
   with b and c as matrices. A more Julian idiom for this is to do 
 something
   like this:
  
   function simplex(A::Matrix, b::Vector, c::Vector)
  
   (m,n) = size(A);
   ...
  
   end
   simplex(A::Matrix, b::Matrix, c::Matrix) = simplex(A, vec(b), vec(c))
  
  
   This also avoids copying the data of b and c needlessly.
  
   On Wednesday, November 26, 2014, Emerson Vitor Castelani 
  
   emerso...@gmail.com javascript: wrote:
   Have you considered the example scsd8.mat?
  
   Em quarta-feira, 26 de novembro de 2014 14h39min14s UTC-2, Pileas
  
   escreveu:
   Result with tic() toc() at the very beginning and at the very end:
  
   elapsed time: 0.025719973 seconds
  
  
   Τη Τετάρτη, 26 Νοεμβρίου 2014 11:06:26 π.μ. UTC-5, ο χρήστης 
 Emerson
  
   Vitor Castelani έγραψε:
   Well, I am tried to implement a simple version of simplex in 
 Julia and
   I have had some troubles. In Julia, my algorithm spends about 30 
 sec
   and in
   matlab/octave 3 sec for the same problem. So, I saw some tips in 
 order
   to
   get a better performance but the best that I got in Julia was 
 17-20
   sec.
   The codes are in attachment. I am new in Julia and the algorithms 
 are
   little roughly implemented but they are very similar.
  
   Thanks





Re: [julia-users] simplex in Julia is very slow

2014-11-28 Thread Emerson Vitor Castelani
Ok! 

Thank you,

Emerson

Em sexta-feira, 28 de novembro de 2014 16h06min10s UTC-2, Stefan Karpinski 
escreveu:

 Something is going on with the type inference of backslash, e.g. see

 (@code_typed rand(3,3)\rand(3))[1].args[3]

 But I can't figure out what. Issue filed: 
 https://github.com/JuliaLang/julia/issues/9191.

 On Fri, Nov 28, 2014 at 11:51 AM, Emerson Vitor Castelani 
 emerso...@gmail.com javascript: wrote:

 Hi Stefan. I am very grateful by your attention. Each variable typed 
 correctly doesn't change the perfomance. Do you have other suggestion to me?

 Thanks,

 -Emerson

 Em quarta-feira, 26 de novembro de 2014 17h52min57s UTC-2, Stefan 
 Karpinski escreveu:

 I wonder if \ might be type unstable.

 On Wed, Nov 26, 2014 at 2:49 PM, Stefan Karpinski ste...@karpinski.org 
 wrote:

 It turns out that doesn't actually matter but there are other unrelated 
 ill-typed variables in the code:

 Xb, o, y, r, e, Nj, ind, q, t


 I haven't determined why this is happening, but something is ill-typed 
 here.

 On Wed, Nov 26, 2014 at 1:20 PM, Tim Holy tim@gmail.com wrote:

 Stefan's point is more relevant than you realize; if the type of the 
 variable
 is uncertain, the loop will be very slow. You can make that resize 
 operation a
 separate function, from which you call your main routine.

 --Tim

 On Wednesday, November 26, 2014 09:26:35 AM Emerson Vitor Castelani 
 wrote:
  Humm, It's useful but I guess that the problem is something in loop 
 while...
 
  Em quarta-feira, 26 de novembro de 2014 15h05min03s UTC-2, Stefan 
 Karpinski
 
  escreveu:
   I'm not sure if this is the problem, but changing the type of a 
 variable
   in a function body causes problems for type inference. For that 
 reason,
   the
   first two lines of this code may cause performance issue if you 
 call this
   with b and c as matrices. A more Julian idiom for this is to do 
 something
   like this:
  
   function simplex(A::Matrix, b::Vector, c::Vector)
  
   (m,n) = size(A);
   ...
  
   end
   simplex(A::Matrix, b::Matrix, c::Matrix) = simplex(A, vec(b), 
 vec(c))
  
  
   This also avoids copying the data of b and c needlessly.
  
   On Wednesday, November 26, 2014, Emerson Vitor Castelani 
  
   emerso...@gmail.com javascript: wrote:
   Have you considered the example scsd8.mat?
  
   Em quarta-feira, 26 de novembro de 2014 14h39min14s UTC-2, Pileas
  
   escreveu:
   Result with tic() toc() at the very beginning and at the very 
 end:
  
   elapsed time: 0.025719973 seconds
  
  
   Τη Τετάρτη, 26 Νοεμβρίου 2014 11:06:26 π.μ. UTC-5, ο χρήστης 
 Emerson
  
   Vitor Castelani έγραψε:
   Well, I am tried to implement a simple version of simplex in 
 Julia and
   I have had some troubles. In Julia, my algorithm spends about 
 30 sec
   and in
   matlab/octave 3 sec for the same problem. So, I saw some tips 
 in order
   to
   get a better performance but the best that I got in Julia was 
 17-20
   sec.
   The codes are in attachment. I am new in Julia and the 
 algorithms are
   little roughly implemented but they are very similar.
  
   Thanks






Re: [julia-users] simplex in Julia is very slow

2014-11-27 Thread Emerson Vitor Castelani

In my test, I change the code and define Xb::Vector, o::Vector,... etc but 
the result doesn't change. Is there some special way to define them?

Regards 

Em quarta-feira, 26 de novembro de 2014 17h50min04s UTC-2, Stefan Karpinski 
escreveu:

 It turns out that doesn't actually matter but there are other unrelated 
 ill-typed variables in the code:

 Xb, o, y, r, e, Nj, ind, q, t


 I haven't determined why this is happening, but something is ill-typed 
 here.

 On Wed, Nov 26, 2014 at 1:20 PM, Tim Holy tim@gmail.com javascript:
  wrote:

 Stefan's point is more relevant than you realize; if the type of the 
 variable
 is uncertain, the loop will be very slow. You can make that resize 
 operation a
 separate function, from which you call your main routine.

 --Tim

 On Wednesday, November 26, 2014 09:26:35 AM Emerson Vitor Castelani wrote:
  Humm, It's useful but I guess that the problem is something in loop 
 while...
 
  Em quarta-feira, 26 de novembro de 2014 15h05min03s UTC-2, Stefan 
 Karpinski
 
  escreveu:
   I'm not sure if this is the problem, but changing the type of a 
 variable
   in a function body causes problems for type inference. For that 
 reason,
   the
   first two lines of this code may cause performance issue if you call 
 this
   with b and c as matrices. A more Julian idiom for this is to do 
 something
   like this:
  
   function simplex(A::Matrix, b::Vector, c::Vector)
  
   (m,n) = size(A);
   ...
  
   end
   simplex(A::Matrix, b::Matrix, c::Matrix) = simplex(A, vec(b), vec(c))
  
  
   This also avoids copying the data of b and c needlessly.
  
   On Wednesday, November 26, 2014, Emerson Vitor Castelani 
  
   emerso...@gmail.com javascript: wrote:
   Have you considered the example scsd8.mat?
  
   Em quarta-feira, 26 de novembro de 2014 14h39min14s UTC-2, Pileas
  
   escreveu:
   Result with tic() toc() at the very beginning and at the very end:
  
   elapsed time: 0.025719973 seconds
  
  
   Τη Τετάρτη, 26 Νοεμβρίου 2014 11:06:26 π.μ. UTC-5, ο χρήστης Emerson
  
   Vitor Castelani έγραψε:
   Well, I am tried to implement a simple version of simplex in Julia 
 and
   I have had some troubles. In Julia, my algorithm spends about 30 
 sec
   and in
   matlab/octave 3 sec for the same problem. So, I saw some tips in 
 order
   to
   get a better performance but the best that I got in Julia was 17-20
   sec.
   The codes are in attachment. I am new in Julia and the algorithms 
 are
   little roughly implemented but they are very similar.
  
   Thanks




[julia-users] Re: simplex in Julia is very slow

2014-11-26 Thread Emerson Vitor Castelani
Have you considered the example scsd8.mat?

Em quarta-feira, 26 de novembro de 2014 14h39min14s UTC-2, Pileas escreveu:

 Result with tic() toc() at the very beginning and at the very end:

 elapsed time: 0.025719973 seconds


 Τη Τετάρτη, 26 Νοεμβρίου 2014 11:06:26 π.μ. UTC-5, ο χρήστης Emerson Vitor 
 Castelani έγραψε:

 Well, I am tried to implement a simple version of simplex in Julia and I 
 have had some troubles. In Julia, my algorithm spends about 30 sec and in 
 matlab/octave 3 sec for the same problem. So, I saw some tips in order to 
 get a better performance but the best that I got in Julia was 17-20 sec. 
 The codes are in attachment. I am new in Julia and the algorithms are 
 little roughly implemented but they are very similar.

 Thanks




Re: [julia-users] simplex in Julia is very slow

2014-11-26 Thread Emerson Vitor Castelani
Humm, It's useful but I guess that the problem is something in loop while...

Em quarta-feira, 26 de novembro de 2014 15h05min03s UTC-2, Stefan Karpinski 
escreveu:

 I'm not sure if this is the problem, but changing the type of a variable 
 in a function body causes problems for type inference. For that reason, the 
 first two lines of this code may cause performance issue if you call this 
 with b and c as matrices. A more Julian idiom for this is to do something 
 like this:

 function simplex(A::Matrix, b::Vector, c::Vector)
 (m,n) = size(A); 
 ...
 end
 simplex(A::Matrix, b::Matrix, c::Matrix) = simplex(A, vec(b), vec(c))


 This also avoids copying the data of b and c needlessly.

 On Wednesday, November 26, 2014, Emerson Vitor Castelani 
 emerso...@gmail.com javascript: wrote:

 Have you considered the example scsd8.mat?

 Em quarta-feira, 26 de novembro de 2014 14h39min14s UTC-2, Pileas 
 escreveu:

 Result with tic() toc() at the very beginning and at the very end:

 elapsed time: 0.025719973 seconds


 Τη Τετάρτη, 26 Νοεμβρίου 2014 11:06:26 π.μ. UTC-5, ο χρήστης Emerson 
 Vitor Castelani έγραψε:

 Well, I am tried to implement a simple version of simplex in Julia and 
 I have had some troubles. In Julia, my algorithm spends about 30 sec and 
 in 
 matlab/octave 3 sec for the same problem. So, I saw some tips in order to 
 get a better performance but the best that I got in Julia was 17-20 sec. 
 The codes are in attachment. I am new in Julia and the algorithms are 
 little roughly implemented but they are very similar.

 Thanks