Hi guys, I wanted to expand the "show me an image" from ProgrammAB. As far as i am right now it opens the image in a new Browser Tab with Barebonesbrowser. (In the forum a few days earlier)
My plan is to open it in a way where i could manipulate it, for example resize or fullsize it. The question is which is the way to go, as there are different approaches possible.
 

Approaches I know about:
-Swing
-OpenCV?
-Browser (maybe with the new WebGui?)

 

Endgoal in a time, far far away: Have the Robot to project a requested image on a wall or on the floor.

I'd be glad to hear some suggestions what the cons/pros of which approach are or maybe even what would be the best, so i can do my (tiny) part to mrl.

kwatters

8 years 11 months ago

Hi Kakadu31!

  I suppose the question is how do you want to do it.  In the short term, it sounds like you're able to open a browser to display the image.  The WebGui is already a browser, so we could try to make an image show up in the browser like that, or there is the old Swing based gui.  We're generally moving away from the Swing GUI, but sometimes it's still useful.  

 You mentioned OpenCV, and open CV does have a lot of capabilities for dealing with Image data.  I guess the question is what is the end goal here?  It sounds like the goal is to be able to display/project the image.  This likely means that you want to display the image full screen.  I think that should be do-able.

  My guess is that you've got ProgramAB returning back a URL to an image.  From ProgramAB you could invoke a method on a service to display the image full screen.  As it stands now, I suspect if you had a python method that could display the image full screen, and have programAB use an OOB tag to invoke that python method, that would be a quick/easy way to do it.

  We actually use "jython" as our python interpreter, so it might not have all the libraries that you are looking for.  

Many ways to make this happen.. just need to pick a path and start going down it..

-Kevin

 

 

Kakadu31

8 years 11 months ago

In reply to by kwatters

So i will jsut choose one and try it out!
Is it possble to us usual openCv commands like you would in a standalone script like:

 cv2.imshow("test",img) ?

And shouldnt i just write a java class for it and you could help me to implement it in mrl? So i could add some different functions (methods) which could maybe uses more universal.

GroG

8 years 11 months ago

Hi Kakadu31,
This is your endgoal ya ? :D

I think you have excellent ideas !
I tried your ImageDisplay service - and found myself staring at Kevin Bob & Stuart  WOOHOO !

I've scanned over your code. I'm impressed with how much and how well you did with very little help.  Do you practice Code-Fu by profession?

I like the way you organized things - very clean & clear.

Here are some suggestions :

1. Change your comments with
/**
*  .... comment ...
*/
This will generate JavaDocs

2. We use camel case (well done) ... whenever you have an abbreviation .. the following letters are small cased just like a word would be .. e.g. parseXML  should be parseXml ... same goes for buildFrameFs 

3. Swing Gah ! :)  We are moving away from swing display, although its very cool you got it all to work ..
Theoretically you could test your Angular skillz and do the same thing in Angular

Here is a Angular lib which looks like it would work :

https://github.com/fabiobiondi/angular-fullscreen 

with demo here :

http://www.fabiobiondi.com/demo/github/angular-fullscreen/demo/

If you do it in Angular JS - the display components become remote - and the Service will have no actual display methods .. which begs the question .. "What will ImageDisplay do?" ... the answer being very little since its a "image display" versus "image processor" ... just thinking ahead about possiblities... its good to have clear definitions of roles & responsiblities for services..

For example thumbnails - or tiles might be wanted - but for the most part this is controlled by Angular and not actual manipulations of the original image file data.. 

just some ideas to keep you rolling ...

4. We don't use - System.out.println ..  log is much more capable...
log.info("some info statement {}", someVar)
Or if you want the information to be propegated to a display (or other subscribers) you can just do
info("hello world) ... this sends publishes a Status object of info level to any subscribers

5. Only Services should be in org.myrobotlab.service ..  DisplayedImage should be in an already existing package .. e.g. org.myrobotlab.image  ..  Some utilities and processes expect only services in the service package.

 
I've updated your service a little - always be sure to "pull" before committing - if you pull often you can typically avoid messy merges...
 
Great work .. hope to see more soon !

GroG

8 years 7 months ago

In reply to by moz4r

Hmm .. I can't get it to "not" work, besides invalid SSL certs, which is the problem..  
perhaps you have a flakey network route to that resource ?

Do you know how to force ImageDisplay to use Swing  instead of Webgui ?

Fullscreen imagedisplay cause blackscreen, only when webgui is loaded

Thank you

 

Hi !  I have more informations :

If I paste the code directly into Swing GUI python window  it's ok

BUT if I invoke the script from command line > no worky  . Even if I launch Guiservice

This is maybe an error :

18:18:36.174 [AWT-EventQueue-0] INFO  c.myrobotlab.framework.Instantiator - class org.myrobotlab.control.ImageDisplayGUI not found
18:18:36.175 [AWT-EventQueue-0] INFO  c.myrobotlab.service.GUIService - could not construct a org.myrobotlab.control.ImageDisplayGUI object - creating generic template

----

the script :

Runtime.createAndStart("Image", "ImageDisplay")
sleep(1)
Image.displayFullScreen("http://img0.mxstatic.com/wallpapers/4b614f524b8c61e7973e57d8d5113d2c_la…)

 

Thank you

 

Moz4r

 

 

 

 

I found a workarround it working :

def DisplayPic(pic):
 
 image.displayFullScreen(pic,1)
 time.sleep(0.1)
 image.displayFullScreen(pic,1)
 time.sleep(2)
 image.exitFS()