Pharo image processing library

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Pharo image processing library

pablo1n7
Hi everyone!

I’m searching for one library for image processing in Pharo. I couldn't find anything (only wrappers) so I tried programming one for basic operations (sum, 
subtraction) with images using class “Form”.

What do you think about this?


For providing a context, I'm studying a PhD. in image processing, but all of the operations that I do, do it in Python. I try using Pharo for more fun :D.

Best Regards Pablo.

Captura de Pantalla 2020-01-23 a la(s) 20.57.00.jpg (81K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Pharo image processing library

SergeStinckwich
Great work !

We have a math library with a lot code that might help you here:

On Fri, Jan 24, 2020 at 11:20 PM Pablo Navarro <[hidden email]> wrote:
Hi everyone!

I’m searching for one library for image processing in Pharo. I couldn't find anything (only wrappers) so I tried programming one for basic operations (sum, 
subtraction) with images using class “Form”.

What do you think about this?


For providing a context, I'm studying a PhD. in image processing, but all of the operations that I do, do it in Python. I try using Pharo for more fun :D.

Best Regards Pablo.


--
Serge Stinckwic
​h​

Int. Research Unit
 on Modelling/Simulation of Complex Systems (UMMISCO)
​Sorbonne University
 (SU)
French National Research Institute for Sustainable Development (IRD)​
U
​niversity of Yaoundé I​, Cameroon
"Programs must be written for people to read, and only incidentally for machines to execute."
https://twitter.com/SergeStinckwich
Reply | Threaded
Open this post in threaded view
|

Re: Pharo image processing library

Oleksandr Zaitsev
In reply to this post by pablo1n7
Hello Pablo,

Is the code of your library available on GitHub?
Could you share the link please?

Oleks



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: Pharo image processing library

SergeStinckwich
In reply to this post by pablo1n7
You may have a look to Cuis library : https://github.com/Cuis-Smalltalk/Numerics
There is an image analysis package.
We have some plan in PolyMath to port it: https://github.com/PolyMathOrg/PolyMath/issues/158

Best,

On Fri, Jan 24, 2020 at 11:20 PM Pablo Navarro <[hidden email]> wrote:
Hi everyone!

I’m searching for one library for image processing in Pharo. I couldn't find anything (only wrappers) so I tried programming one for basic operations (sum, 
subtraction) with images using class “Form”.

What do you think about this?


For providing a context, I'm studying a PhD. in image processing, but all of the operations that I do, do it in Python. I try using Pharo for more fun :D.

Best Regards Pablo.


--
Serge Stinckwic
​h​

Int. Research Unit
 on Modelling/Simulation of Complex Systems (UMMISCO)
​Sorbonne University
 (SU)
French National Research Institute for Sustainable Development (IRD)​
U
​niversity of Yaoundé I​, Cameroon
"Programs must be written for people to read, and only incidentally for machines to execute."
https://twitter.com/SergeStinckwich
Reply | Threaded
Open this post in threaded view
|

Re: Pharo image processing library

pablo1n7
Hi everyone! Thanks for the comments, I don't create a repository yet because, in this first version, I just wanted to try if it was possible, so only create a Form subclass and add three methods.

Form subclass: #ImageForm
instanceVariableNames: 'mode'
classVariableNames: ''
package: ‘SmallImage'

——>

+ aImage
"add two image and return a new ImageForm"
|aImageResult|

aImageResult := self deepCopy.

0 to: self width do:[:x| 0 to: self height
do:[:y|
|aPoint aColorA aColorB|
aPoint := (Point x: x y: y).
aColorA := aImageResult colorAt: aPoint.
aColorB := aImage colorAt: aPoint.
aImageResult colorAt: aPoint put: aColorA + aColorB. ]].
^ aImageResult

—->

show: anTitle
"Show a image in a window, scale the image to 500"
|im|
im := (ImageMorph withForm: (self scaledIntoFormOfSize:500) ).
im withSnapshotBorder.
im borderWidth: 5.
im color: (Color gray).
im openInWindowLabeled: (anTitle,' | mode: ', self mode asLowercase, '| ', self shape).

-—>


The first problem I found was the class Form return 'Form new' and not 'self class new' so I had to create two class method (in ImageForm):

newFrom: aForm mode: aMode
"create an ImageForm from to a Form object."
| aImage|

 aImage := self new.
 aImage copyFrom: aForm.
 aImage mode: aMode.
 ^ aImage.

—>

open: aFileName
“Open a image.”
| aImage aForm|
 aForm := ImageReadWriter formFromFileNamed: aFileName.
 aImage := self newFrom: aForm mode: ‘ARGB’.
 ^ aImage.

—>


I think that the methods (+ and show) should be directly in the class Form but I didn't want to change the original. If you think it's okay, I can continue working and this week upload to github with their respective tests.

P.S. sorry for my limited English.




Best Regards Pablo.
El 25 de ene. de 2020 12:10 -0300, Stéphane Ducasse <[hidden email]>, escribió:
what I always find strange is that people do not invest in tests for domains that are super nice to test….

S. 

On 25 Jan 2020, at 16:04, Serge Stinckwich <[hidden email]> wrote:

You may have a look to Cuis library : https://github.com/Cuis-Smalltalk/Numerics
There is an image analysis package.
We have some plan in PolyMath to port it: https://github.com/PolyMathOrg/PolyMath/issues/158

Best,

On Fri, Jan 24, 2020 at 11:20 PM Pablo Navarro <[hidden email]> wrote:
Hi everyone!

I’m searching for one library for image processing in Pharo. I couldn't find anything (only wrappers) so I tried programming one for basic operations (sum, 
subtraction) with images using class “Form”.

What do you think about this?


For providing a context, I'm studying a PhD. in image processing, but all of the operations that I do, do it in Python. I try using Pharo for more fun :D.

Best Regards Pablo.


--
Serge Stinckwic
​h​

Int. Research Unit
 on Modelling/Simulation of Complex Systems (UMMISCO)
​Sorbonne University
 (SU)
French National Research Institute for Sustainable Development (IRD)​
U
​niversity of Yaoundé I​, Cameroon
"Programs must be written for people to read, and only incidentally for machines to execute."
https://twitter.com/SergeStinckwich

--------------------------------------------
Stéphane Ducasse
03 59 35 87 52
Assistant: Julie Jonas 
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley, 
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France

Reply | Threaded
Open this post in threaded view
|

Re: Pharo image processing library

pablo1n7
I'll work on those tests and then we'll do the subclass for image processing.

:)

I'm very happy to contribute to this project.

Pablo.


El dom., 26 ene. 2020 12:08, Stéphane Ducasse <[hidden email]> escribió:
Pablo

if you are interested I would like to increase the tests around Form. 
The three that exist are in FormTest and to a certain extent to BitBltTest.
If you write  tests I will happily review and integrate in the system.
( I will see if I can hijack some time during a boring meeting to produce some more). 

I also check the reference to Form and clearly the class Form itself refers too much to it. 
Now with more tests we would be more confident to change. 


S.


On 25 Jan 2020, at 17:41, Pablo Navarro <[hidden email]> wrote:

Hi everyone! Thanks for the comments, I don't create a repository yet because, in this first version, I just wanted to try if it was possible, so only create a Form subclass and add three methods.

Form subclass: #ImageForm
instanceVariableNames: 'mode'
classVariableNames: ''
package: ‘SmallImage'

——>

+ aImage
"add two image and return a new ImageForm"
|aImageResult|

aImageResult := self deepCopy.

0 to: self width do:[:x| 0 to: self height
do:[:y|
|aPoint aColorA aColorB|
aPoint := (Point x: x y: y).
aColorA := aImageResult colorAt: aPoint.
aColorB := aImage colorAt: aPoint.
aImageResult colorAt: aPoint put: aColorA + aColorB. ]].
^ aImageResult

—->

show: anTitle
"Show a image in a window, scale the image to 500"
|im|
im := (ImageMorph withForm: (self scaledIntoFormOfSize:500) ).
im withSnapshotBorder.
im borderWidth: 5.
im color: (Color gray).
im openInWindowLabeled: (anTitle,' | mode: ', self mode asLowercase, '| ', self shape).

-—>


The first problem I found was the class Form return 'Form new' and not 'self class new' so I had to create two class method (in ImageForm):

newFrom: aForm mode: aMode
"create an ImageForm from to a Form object."
| aImage|

 aImage := self new.
 aImage copyFrom: aForm.
 aImage mode: aMode.
 ^ aImage.

—>

open: aFileName
“Open a image.”
| aImage aForm|
 aForm := ImageReadWriter formFromFileNamed: aFileName.
 aImage := self newFrom: aForm mode: ‘ARGB’.
 ^ aImage.

—>


I think that the methods (+ and show) should be directly in the class Form but I didn't want to change the original. If you think it's okay, I can continue working and this week upload to github with their respective tests.

P.S. sorry for my limited English.




Best Regards Pablo.
El 25 de ene. de 2020 12:10 -0300, Stéphane Ducasse <[hidden email]>, escribió:
what I always find strange is that people do not invest in tests for domains that are super nice to test….

S. 

On 25 Jan 2020, at 16:04, Serge Stinckwich <[hidden email]> wrote:

You may have a look to Cuis library : https://github.com/Cuis-Smalltalk/Numerics
There is an image analysis package.
We have some plan in PolyMath to port it: https://github.com/PolyMathOrg/PolyMath/issues/158

Best,

On Fri, Jan 24, 2020 at 11:20 PM Pablo Navarro <[hidden email]> wrote:
Hi everyone!

I’m searching for one library for image processing in Pharo. I couldn't find anything (only wrappers) so I tried programming one for basic operations (sum, 
subtraction) with images using class “Form”.

What do you think about this?


For providing a context, I'm studying a PhD. in image processing, but all of the operations that I do, do it in Python. I try using Pharo for more fun :D.

Best Regards Pablo.


--
Serge Stinckwic
​h​

Int. Research Unit
 on Modelling/Simulation of Complex Systems (UMMISCO)
​Sorbonne University
 (SU)
French National Research Institute for Sustainable Development (IRD)​
U
​niversity of Yaoundé I​, Cameroon
"Programs must be written for people to read, and only incidentally for machines to execute."
https://twitter.com/SergeStinckwich

--------------------------------------------
Stéphane Ducasse
03 59 35 87 52
Assistant: Julie Jonas 
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley, 
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France


--------------------------------------------
Stéphane Ducasse
03 59 35 87 52
Assistant: Julie Jonas 
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley, 
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France

Reply | Threaded
Open this post in threaded view
|

Re: Pharo image processing library

hernanmd
In reply to this post by pablo1n7
Hi Pablo,

I did some experiment with the Form class some time ago, maybe you can borrow something from here: https://80738163270632.blogspot.com/2018/10/pharo-script-of-day-proto-proto-image.html

Hernán


El sáb., 25 ene. 2020 a las 13:42, Pablo Navarro (<[hidden email]>) escribió:
Hi everyone! Thanks for the comments, I don't create a repository yet because, in this first version, I just wanted to try if it was possible, so only create a Form subclass and add three methods.

Form subclass: #ImageForm
instanceVariableNames: 'mode'
classVariableNames: ''
package: ‘SmallImage'

——>

+ aImage
"add two image and return a new ImageForm"
|aImageResult|

aImageResult := self deepCopy.

0 to: self width do:[:x| 0 to: self height
do:[:y|
|aPoint aColorA aColorB|
aPoint := (Point x: x y: y).
aColorA := aImageResult colorAt: aPoint.
aColorB := aImage colorAt: aPoint.
aImageResult colorAt: aPoint put: aColorA + aColorB. ]].
^ aImageResult

—->

show: anTitle
"Show a image in a window, scale the image to 500"
|im|
im := (ImageMorph withForm: (self scaledIntoFormOfSize:500) ).
im withSnapshotBorder.
im borderWidth: 5.
im color: (Color gray).
im openInWindowLabeled: (anTitle,' | mode: ', self mode asLowercase, '| ', self shape).

-—>


The first problem I found was the class Form return 'Form new' and not 'self class new' so I had to create two class method (in ImageForm):

newFrom: aForm mode: aMode
"create an ImageForm from to a Form object."
| aImage|

 aImage := self new.
 aImage copyFrom: aForm.
 aImage mode: aMode.
 ^ aImage.

—>

open: aFileName
“Open a image.”
| aImage aForm|
 aForm := ImageReadWriter formFromFileNamed: aFileName.
 aImage := self newFrom: aForm mode: ‘ARGB’.
 ^ aImage.

—>


I think that the methods (+ and show) should be directly in the class Form but I didn't want to change the original. If you think it's okay, I can continue working and this week upload to github with their respective tests.

P.S. sorry for my limited English.




Best Regards Pablo.
El 25 de ene. de 2020 12:10 -0300, Stéphane Ducasse <[hidden email]>, escribió:
what I always find strange is that people do not invest in tests for domains that are super nice to test….

S. 

On 25 Jan 2020, at 16:04, Serge Stinckwich <[hidden email]> wrote:

You may have a look to Cuis library : https://github.com/Cuis-Smalltalk/Numerics
There is an image analysis package.
We have some plan in PolyMath to port it: https://github.com/PolyMathOrg/PolyMath/issues/158

Best,

On Fri, Jan 24, 2020 at 11:20 PM Pablo Navarro <[hidden email]> wrote:
Hi everyone!

I’m searching for one library for image processing in Pharo. I couldn't find anything (only wrappers) so I tried programming one for basic operations (sum, 
subtraction) with images using class “Form”.

What do you think about this?


For providing a context, I'm studying a PhD. in image processing, but all of the operations that I do, do it in Python. I try using Pharo for more fun :D.

Best Regards Pablo.


--
Serge Stinckwic
​h​

Int. Research Unit
 on Modelling/Simulation of Complex Systems (UMMISCO)
​Sorbonne University
 (SU)
French National Research Institute for Sustainable Development (IRD)​
U
​niversity of Yaoundé I​, Cameroon
"Programs must be written for people to read, and only incidentally for machines to execute."
https://twitter.com/SergeStinckwich

--------------------------------------------
Stéphane Ducasse
03 59 35 87 52
Assistant: Julie Jonas 
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley, 
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France

Reply | Threaded
Open this post in threaded view
|

Re: Pharo image processing library

pablo1n7
hi, I’m looking. very interesting, thanks.

Pablo.
El 27 de ene. de 2020 00:35 -0300, Any question about pharo is welcome <[hidden email]>, escribió:

Reply | Threaded
Open this post in threaded view
|

Re: Pharo image processing library

SergeStinckwich
And the code here: https://github.com/Cuis-Smalltalk/Numerics/blob/master/ImageProcessing.pck.st

I think that if you put all your code and the existing code with tests in a repo, you will have a nice project to start 😀

Enjoy

Sent from my iPhone

On 27 Jan 2020, at 12:39, Pablo Navarro <[hidden email]> wrote:


hi, I’m looking. very interesting, thanks.

Pablo.
El 27 de ene. de 2020 00:35 -0300, Any question about pharo is welcome <[hidden email]>, escribió:

Reply | Threaded
Open this post in threaded view
|

Re: Pharo image processing library

pablo1n7
Hi everyone!

after what we talked about the other day, I started to work with the test cases of Form. I don´t know if the best form for share but I load some in my Github: https://github.com/pablo1n7/FormTest. There are still many tests to do but it's a beginning.

For the other hand, I created a repository for ImageForm: https://github.com/pablo1n7/ImageForm (Thanks to Julien Delplanque for the guide).

I made tests for all the methods (do this with images is so funny :D) and load some examples.

Thanks
Pablo.


El 27 de ene. de 2020 08:49 -0300, Any question about pharo is welcome <[hidden email]>, escribió:

Reply | Threaded
Open this post in threaded view
|

Re: Pharo image processing library

pablo1n7
In reply to this post by Oleksandr Zaitsev
Hi everyone

I put available my code for Image Form in GitHub (https://github.com/pablo1n7/ImageForm). This afternoon, I did the operations with kernels :D.

It's not 100% complete, I'm still working on it. I hope you find it useful and any suggestion is welcomed

Best Regards, Pablo.

El 25 de ene. de 2020 11:33 -0300, Oleksandr Zaitsev <[hidden email]>, escribió:
Hello Pablo,

Is the code of your library available on GitHub?
Could you share the link please?

Oleks



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: Pharo image processing library

Kasper Osterbye
Cool! 
I like that readme.

Best,

Kasper


On 6 February 2020 at 03.26.05, Pablo Navarro ([hidden email]) wrote:

Hi everyone

I put available my code for Image Form in GitHub (https://github.com/pablo1n7/ImageForm). This afternoon, I did the operations with kernels :D.

It's not 100% complete, I'm still working on it. I hope you find it useful and any suggestion is welcomed

Best Regards, Pablo.

El 25 de ene. de 2020 11:33 -0300, Oleksandr Zaitsev <[hidden email]>, escribió:
Hello Pablo,

Is the code of your library available on GitHub?
Could you share the link please?

Oleks



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: Pharo image processing library

Sven Van Caekenberghe-2


> On 6 Feb 2020, at 07:10, Kasper Østerbye <[hidden email]> wrote:
>
> Cool!
> I like that readme.

+100 beautiful !

> Best,
>
> Kasper
>
>
> On 6 February 2020 at 03.26.05, Pablo Navarro ([hidden email]) wrote:
>
>> Hi everyone
>>
>> I put available my code for Image Form in GitHub (https://github.com/pablo1n7/ImageForm). This afternoon, I did the operations with kernels :D.
>>
>> It's not 100% complete, I'm still working on it. I hope you find it useful and any suggestion is welcomed
>>
>> Best Regards, Pablo.
>> El 25 de ene. de 2020 11:33 -0300, Oleksandr Zaitsev <[hidden email]>, escribió:
>>> Hello Pablo,
>>>
>>> Is the code of your library available on GitHub?
>>> Could you share the link please?
>>>
>>> Oleks
>>>
>>>
>>>
>>> --
>>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html


Reply | Threaded
Open this post in threaded view
|

Re: Pharo image processing library

EstebanLM
Wow, very nice :)

Esteban

> On 6 Feb 2020, at 10:40, Sven Van Caekenberghe <[hidden email]> wrote:
>
>
>
>> On 6 Feb 2020, at 07:10, Kasper Østerbye <[hidden email]> wrote:
>>
>> Cool!
>> I like that readme.
>
> +100 beautiful !
>
>> Best,
>>
>> Kasper
>>
>>
>> On 6 February 2020 at 03.26.05, Pablo Navarro ([hidden email]) wrote:
>>
>>> Hi everyone
>>>
>>> I put available my code for Image Form in GitHub (https://github.com/pablo1n7/ImageForm). This afternoon, I did the operations with kernels :D.
>>>
>>> It's not 100% complete, I'm still working on it. I hope you find it useful and any suggestion is welcomed
>>>
>>> Best Regards, Pablo.
>>> El 25 de ene. de 2020 11:33 -0300, Oleksandr Zaitsev <[hidden email]>, escribió:
>>>> Hello Pablo,
>>>>
>>>> Is the code of your library available on GitHub?
>>>> Could you share the link please?
>>>>
>>>> Oleks
>>>>
>>>>
>>>>
>>>> --
>>>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Pharo image processing library

SergeStinckwich
In reply to this post by pablo1n7
Great work Pablo !
Nice to see code examples of what you have done until now.

Best,

On Thu, Feb 6, 2020 at 3:26 AM Pablo Navarro <[hidden email]> wrote:
Hi everyone

I put available my code for Image Form in GitHub (https://github.com/pablo1n7/ImageForm). This afternoon, I did the operations with kernels :D.

It's not 100% complete, I'm still working on it. I hope you find it useful and any suggestion is welcomed

Best Regards, Pablo.

El 25 de ene. de 2020 11:33 -0300, Oleksandr Zaitsev <[hidden email]>, escribió:
Hello Pablo,

Is the code of your library available on GitHub?
Could you share the link please?

Oleks



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



--
Serge Stinckwic
​h​

Int. Research Unit
 on Modelling/Simulation of Complex Systems (UMMISCO)
​Sorbonne University
 (SU)
French National Research Institute for Sustainable Development (IRD)​
U
​niversity of Yaoundé I​, Cameroon
"Programs must be written for people to read, and only incidentally for machines to execute."
https://twitter.com/SergeStinckwich