Re: [Pharo-users] Pharo image processing library
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 <stephane.ducasse@inria.fr>, 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 <serge.stinckwich@gmail.com> 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 <pablo1n7@gmail.com> 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 http://stephane.ducasse.free.fr / http://www.pharo.org 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
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-... Hernán El sáb., 25 ene. 2020 a las 13:42, Pablo Navarro (<pablo1n7@gmail.com>) 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 < stephane.ducasse@inria.fr>, 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 <serge.stinckwich@gmail.com> 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 <pablo1n7@gmail.com> 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 http://stephane.ducasse.free.fr / http://www.pharo.org 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
hi, Iâm looking. very interesting, thanks. Pablo. El 27 de ene. de 2020 00:35 -0300, Any question about pharo is welcome <pharo-users@lists.pharo.org>, escribió:
https://80738163270632.blogspot.com/2018/10/pharo-script-of-day-proto-proto-...
And the code here: https://github.com/Cuis-Smalltalk/Numerics/blob/master/ImageProcessing.pck.s... 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 <pablo1n7@gmail.com> wrote:
 hi, Iâm looking. very interesting, thanks.
Pablo. El 27 de ene. de 2020 00:35 -0300, Any question about pharo is welcome <pharo-users@lists.pharo.org>, escribió:
https://80738163270632.blogspot.com/2018/10/pharo-script-of-day-proto-proto-...
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 <pharo-users@lists.pharo.org>, escribió:
https://github.com/Cuis-Smalltalk/Numerics/blob/master/ImageProcessing.pck.s...
participants (3)
-
Hernán Morales Durand -
Pablo Navarro -
serge.stinckwich@gmail.com