Pabloif 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 <pablo1n7@gmail.com> 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 <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/NumericsThere is an image analysis package.We have some plan in PolyMath to port it: https://github.com/PolyMathOrg/PolyMath/issues/158Best,
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 Ducasse03 59 35 87 52Assistant: Julie Jonas��FAX 03 59 57 78 50TEL 03 59 35 86 16S. Ducasse - Inria40, avenue Halley,��Parc Scientifique de la Haute Borne, B��t.A, Park PlazaVilleneuve d'Ascq 59650France--------------------------------------------St��phane Ducasse03 59 35 87 52Assistant: Julie Jonas��FAX 03 59 57 78 50TEL 03 59 35 86 16S. Ducasse - Inria40, avenue Halley,��Parc Scientifique de la Haute Borne, B��t.A, Park PlazaVilleneuve d'Ascq 59650France