webcam images for image processing

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

webcam images for image processing

dyfroedd
This post was updated on .
Hi

I'm fairly new to Smalltalk and so impressed with the programming style as it helps me visually understand how the classes are interrelated etc.

I would love to use Smalltalk (Squeak or Pharo) for some image processing. I can create my own processing methods and kernels but have had problems accessing the images from a  webcam. I have stumbled at this most basic step.   Can anyone help me to access a webcam on a mac please?

I have read various intros into Squeak and Pharo but doing something really useful like basic image processing is still a hurdle for me in Smalltalk.

Alternatively I can use C++ (and OpenCV) to access and process images and use Smalltalk to build a GUI but that would defeat the purpose of me trying to use SmallTalk to begin with.

I appreciate your help.
Reply | Threaded
Open this post in threaded view
|

Re: webcam images for image processing

Stephane Ducasse-3
- First welcome and do not hesitate to ask any question. 

I know that we have a binding for openCV (dimitry I do not remember) demoes it at ESUG 2014 at Brescia (check the videos on youtube). 

- Second you should use uFFI to talk to the drivers. There is a tutorial in PharoInProgress (I have to run)



Now this is somehow related... check this fun small project made to access public webcam

Stef

PS: it is Smalltalk :)



On Fri, Dec 30, 2016 at 12:49 AM, dyfroedd <[hidden email]> wrote:
Hi

I'm fairly new to SmallTalk and so impressed with the programming style as
it helps me visually understand how the classes are interrelated etc.

I would love to use SmallTalk (Squeak or Pharo) for some image processing. I
can create my own processing methods and kernels but have had problems
accessing the images from a  webcam. I have stumbled at this most basic
step.   Can anyone help me (I am new to SmallTalk) to access a webcam on a
mac please?

I have read various intros into SmallTalk (Squeak and Pharo) but doing
something really useful like basic image processing is still a hurdle for me
in SmallTalk.

Alternatively I can use C++ (and OpenCV) to access and process images and
use smalltalk to build a GUI but that would defeat the purpose of me trying
to use SmallTalk to begin with.

I appreciate your help.



--
View this message in context: http://forum.world.st/webcam-images-for-image-processing-tp4928374.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



=?UTF-8?Q?Handling_Motion_JPEG_video_streams_with_pharo_smalltalk_=C2=BB?= =?UTF-8?Q?_Richard_J=2E_Prinz=2Epdf?= (332K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: webcam images for image processing

kilon.alios
In reply to this post by dyfroedd
Welcome to our Pharo island :)

*gives a flower necklace*

My central ideology about Pharo is that it is a waste of potential to remake libraries that exist in other languages unless we want to bring something new or something more specific.

Thus its a very good idea to use C/C++ libraries and libraries made for other programming languages from inside Pharo. I for instance use Python libraries from inside Pharo.

What I have found is that pharo is excellent as a central nervous system , Brain + nerves , for an application. Because not only the language is simple, but mostly because of live coding and ability of the IDE to deal with complex code and isolate bugs.

Live coding is pretty much the bread and butter for us graphics programmers (I use Pharo together with Unreal and Blender) because it allows us to test things on the fly without having to worry about compile times or syntax errors or crashes or whatever can interrupt us from "being in the zone". Pharo is without exaggeration the best live coding language out there by very far from others except Lisp which is the basis of Smalltalk and where we have borrowed many ideas.

So, my preference in this case would have been to use OpenCL from Pharo via the UFFI. This way you have both the speed you need for heavy graphics processing and all the cool stuff that Pharo has.

Whats the catch ?

Well you have to know C/C++ obviously and you have to know UFFI.

Once you understand UFFI you are practical unstopable and there will be NOTHING you wont be able to do with Pharo.

I will upload a video tutorial for UFFI , I was looking for an interesting example and I think the webcam case you presented via OpenCL is perfect. It will be a long one, probably an hour or so , obviously because a lot have to be presented and explained.

I cannot say exactly when I will upload it because lately life has been hectic (family health issues -- nothing serious but several days in the hospital) and I have no clue how OpenCL works (though I never shy from an interesting challenge) but I hope to have the free time and motivation to do it during this weekend.

On Fri, Dec 30, 2016 at 2:07 AM dyfroedd <[hidden email]> wrote:
Hi

I'm fairly new to SmallTalk and so impressed with the programming style as
it helps me visually understand how the classes are interrelated etc.

I would love to use SmallTalk (Squeak or Pharo) for some image processing. I
can create my own processing methods and kernels but have had problems
accessing the images from a  webcam. I have stumbled at this most basic
step.   Can anyone help me (I am new to SmallTalk) to access a webcam on a
mac please?

I have read various intros into SmallTalk (Squeak and Pharo) but doing
something really useful like basic image processing is still a hurdle for me
in SmallTalk.

Alternatively I can use C++ (and OpenCV) to access and process images and
use smalltalk to build a GUI but that would defeat the purpose of me trying
to use SmallTalk to begin with.

I appreciate your help.



--
View this message in context: http://forum.world.st/webcam-images-for-image-processing-tp4928374.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: webcam images for image processing

kilon.alios
In reply to this post by Stephane Ducasse-3


On Fri, Dec 30, 2016 at 10:47 AM Stephane Ducasse <[hidden email]> wrote:
- First welcome and do not hesitate to ask any question. 

I know that we have a binding for openCV (dimitry I do not remember) demoes it at ESUG 2014 at Brescia (check the videos on youtube). 

- Second you should use uFFI to talk to the drivers. There is a tutorial in PharoInProgress (I have to run)



Now this is somehow related... check this fun small project made to access public webcam

Stef

PS: it is Smalltalk :)



Reply | Threaded
Open this post in threaded view
|

Re: webcam images for image processing

dyfroedd
In reply to this post by Stephane Ducasse-3
Thank you for getting back so quickly. I appreciate the pointers you gave me; I'll check them out. I have edited my post to correct my spelling of Smalltalk - sorry :)
Reply | Threaded
Open this post in threaded view
|

Re: webcam images for image processing

dyfroedd
In reply to this post by kilon.alios

Thank you for getting back so quickly. I appreciate the pointers you gave
me; I'll check them out. I have edited my post to correct my spelling of
Smalltalk - sorry :)



--
View this message in context: http://forum.world.st/webcam-images-for-image-processing-tp4928374p4928393.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: webcam images for image processing

dyfroedd
This post was updated on .
In reply to this post by kilon.alios
This is an awesome forum - thank you so much for replying and I love the way you explained how Smalltalk can be used. I totally agree that the wheel should not be re-invented and that I should learn to make these technologies talk together.

I know that Smalltalk is an amazing tool and, unfortunately, one that is not as well known as others such as Python or C++. The problem is that I cannot find any tutorials showing how to glue these technologies together in the way you said, but instead I have found some posts (few sentences) describing the process abstractly and using comp sci terminology. There is a greater need these days to pass info between various tech and using Smalltalk to do it in the way you suggested will be a good challenge for me - so I'll start digging into it.

I'm building a bespoke robotic system for a client that will access serial sensor data as well as the webcam for image processing. I see Smalltalk as a potentially fantastic tool for this. My gut feeling tells me that I should learn to develop my bespoke tech in Smalltalk, for various reasons, by getting these tech and various glued software to talk together. But doing useful stuff like robotics or image processing requires some demos that I can work with (for me personally, this is how I learn to build my own things).

Appreciate the time you took to get back to me.

Thanks







 
Reply | Threaded
Open this post in threaded view
|

Re: webcam images for image processing

kilon.alios
Pharo is used for robots you can find more info here

http://car.mines-douai.fr/category/pharos/

I am actually building now OpenCV on macos, the hard stuff is C. UFFI and Pharo are a breeze but with C everything can go wrong and it will at some point. Took me 30 minutes to find information on how to build on macos.

I complain about Pharo documentation but OpenCV is much worse , we have a tiny community and still our documentation is tons better.

So I totally can feel you, documentation is a huge issue does not matter what language you choose , its a struggle.

In popular language you can find a gazillion things about the basics and popular stuff but as soon as you venture to specifics and more technical things that are the ones that need documentation the most, then you meet the hell of "no sorry no documentation about this, but you should be fine reading the codes and (then non existent) comments".

But that is part of the fun of coding, overcoming these challenges and enduring until the "Eureka" moment.

Unfortunately OpenCV fails to build for me on macos, I also see that it takes advantage of CUDA which is great news for performance bad news for building it because CUDA is huge and it can be quite tedious to build because there are a ton of stuff to be aware of.

In any case the documentation I linked is what we use to learn about UFFI this is how I learned to make a shared memory tool for manipulating C++ executable from Pharo.

It takes time and patience because in C the moment you do something bad with the memory it crashes the executable (OS default behavior to protect from misbehaving executables) , this means I crashes Pharo like a hundrend time till I get pointers right (how C/C++ manipulates memory). The good news is that unlike C , Pharo is prepared from such situations and will never allow you to lose code but to be safe always use a version control system and commit frequently because it will be a breeze to restore your code after a crash to a pharo image this way.

We have specific tools for such situation , for example Epicea will open after the crash and ask you if you want to restore code and is a great tool but I find git more convenient for such situations.

So to summarize you need to build OpenCV for 32bits architecture and use UFFI. 64bits may work too but you need specific Pharo VM and image. 32bit should be more stable and should be enough because it will try to use the GPU memory anyway which is faster than CPU memory.

I wish I could be more of a help but I do not want to spend a ton of time on building a library that I won't use.
Reply | Threaded
Open this post in threaded view
|

Re: webcam images for image processing

Offray Vladimir Luna Cárdenas-2
In reply to this post by kilon.alios
Hi,


On 30/12/16 03:47, Dimitris Chloupis wrote:
>
>
> What I have found is that pharo is excellent as a central nervous
> system , Brain + nerves , for an application. Because not only the
> language is simple, but mostly because of live coding and ability of
> the IDE to deal with complex code and isolate bugs.

I think that the Pharo approach could be something like the Cyborgs one
of Star Trek. Attach to a preexisting substrate and extend it :-P.
Seriously, having Pharo to talk better with the external
non-Pharo/Smalltalk native technologies and ideas could help to bring
this unpaired live coding experience to a lot of people: hacktivist,
journalist, philosophers, musicians, and non-live coding programmers. My
uses of this approach are trying to bridge Pharo with non-programmers
cultures at our local hackerspace, and is giving very good outcomes.

>
> Live coding is pretty much the bread and butter for us graphics
> programmers (I use Pharo together with Unreal and Blender) because it
> allows us to test things on the fly without having to worry about
> compile times or syntax errors or crashes or whatever can interrupt us
> from "being in the zone". Pharo is without exaggeration the best live
> coding language out there by very far from others except Lisp which is
> the basis of Smalltalk and where we have borrowed many ideas.
>

I would add that live coding is the bread and butter of pretty much
everyone who is making exploratory computing and prototyping in diverse
fields, where you use computers to understand fuzzy problems.

Cheers,

Offray

Reply | Threaded
Open this post in threaded view
|

Re: webcam images for image processing

Mariano Martinez Peck
Hi,

I think you MUST talk to Juan Vuletich (CCed) as he is doing satellites image processing in Smalltalk.

Cheers 


On Fri, Dec 30, 2016 at 3:15 PM, Offray Vladimir Luna Cárdenas <[hidden email]> wrote:
Hi,


On 30/12/16 03:47, Dimitris Chloupis wrote:


What I have found is that pharo is excellent as a central nervous system , Brain + nerves , for an application. Because not only the language is simple, but mostly because of live coding and ability of the IDE to deal with complex code and isolate bugs.

I think that the Pharo approach could be something like the Cyborgs one of Star Trek. Attach to a preexisting substrate and extend it :-P. Seriously, having Pharo to talk better with the external non-Pharo/Smalltalk native technologies and ideas could help to bring this unpaired live coding experience to a lot of people: hacktivist, journalist, philosophers, musicians, and non-live coding programmers. My uses of this approach are trying to bridge Pharo with non-programmers cultures at our local hackerspace, and is giving very good outcomes.


Live coding is pretty much the bread and butter for us graphics programmers (I use Pharo together with Unreal and Blender) because it allows us to test things on the fly without having to worry about compile times or syntax errors or crashes or whatever can interrupt us from "being in the zone". Pharo is without exaggeration the best live coding language out there by very far from others except Lisp which is the basis of Smalltalk and where we have borrowed many ideas.


I would add that live coding is the bread and butter of pretty much everyone who is making exploratory computing and prototyping in diverse fields, where you use computers to understand fuzzy problems.

Cheers,

Offray




--