Is there any work around for Sikuli IDE image replacement? - sikuli

I am using Sikulix for UI testing, the problem is that when ever there are changes in UI I need to replace all the images which got changed using the IDE and I need to again describe the actions ( accuracy, click position) which is becoming a sort of overhead in my case. Is there any work around by which I can simply replace the new UI images in the project folder with the same old name ( It wont work directly as the new coordinates might be different + the new image should be of same resolution that of older one)
PS: I have completely understood that sikuli works at pixel level, but still curious to find out if any one has found a work around.

Unfortunately, you will need to recreate the images. What could make it a bit easier, is if you had more descriptive names than the ones generated by Sikuli IDE automatically. Keep in mind these are just image files stored on your PC. If you have names like button1.png, button1.png, etc.., it will make your life easier.

This may or may not work for you depending on your project development:
In my case, the changes that occur at times reduces the image similarity from say 0.9 defined to ~0.7. Now, rather than going ahead to replace the image with a totally new image where i would have to manipulate the offsets as well now, I capture the same region image at 0.7 similarity and replace it. You can easily create a script for this and even integrate it into your project. Use find to figure out the matching region and capture to take the screenshot of the area. The image caught using this way will now again match at 100% for you also, you have rid yourself from the headache of adjusting the targetoffset. Hope this helps.

Related

AS3 replace string/text with image characters

i am developing the code for a simple game in AS3 and i have all the graphic assets made by a designer.
He wants all the textual messages (i.e. win, lose, lives, etc.) to be done exactly as in the original photoshop drawing, they have lots of visual fx on them.
Since these messages inside the game are dynamic, I tried to use normal textfields and replicate the visual fx with Flash filters, but the result is not even comparable.
I think i could try to export from photoshop a spritesheet with the all the image characters, or the single image characters one by one, and replace my old textfields with sprites/movieclips in which i would load the specific image characters based on the string i need to show to the enduser, but i don't know precisely how to do it.
Does anyone have some hints on how to achieve this result? Better to use a separate class and image library? I googled online hoping to find some class or method alike to customize a little for my needs, but unfortunately i haven't found anything!
You could add all the graphics to the library exporting them with each name.
Than call them when needed creating a MC. If useful, you could store the names in an array and use it to simplify your script (it depends on usage)
Ok, after some more research, i found out my main problem in not finding answers to my problem was the terms of research i was using.
I was erroneously looking for "AS3 string replace with images" or "text replace with images in Flash", while the correct question was: "how to use a BITMAP FONT in AS3".
I was sure someone else had to do what i'm trying to do (like in old games where texts were all image sprites) but i didn't know how to find it!
So, this is the solution i found, i still have to refine the workflow but it's a good starting point:
Create a custom Bitmamp font using the SHOEBOX tool in conjunction with photoshop, where you will be able to apply all the raster fx you want (here's the tutorial: http://renderhjs.net/shoebox/bitmapFont.htm)
You will obtain a .fnt file (descriptor) and a .png image (font characters atlas)
You will need to flip the png image vertically: apparently, a lot of bitmap text engines work with flipped characters, and i found this one to be working like this as well
Once you have these files, use the BMFontRenderer AS3 class to embed your bitmap font into an AS3 project of your choice (tutorial here: http://blog.bengarney.com/2011/12/07/fast-bitmap-fonts-in-flash/)
I hope it will be useful for others who may need to replace standard text in Flash with font images.

Few Questions about PictureChooser Plugin

I'm trying to use the PictureChooser plugin, specifically the ChoosePictureFromLibrary method, and I have a few questions.
Is it possible to show more than just .jpg? I'd like at least .png as well, though maybe other picture types too.
Is it possible not to resize chosen pictures? The maxPixelDimension parameter seems to always resize the image to that size.
Is it possible to have access to the original file name of the chosen picture?
The PictureChooser is really quite a small plugin - it really only has one small class per platform - https://github.com/MvvmCross/MvvmCross/tree/v3.1/Plugins/Cirrious/PictureChooser
Because of this, the easiest route forwards for your specialist needs is probably to "branch" this small part of the code (by repo-forking or just by "copy and paste"). You should then find it straightforward to get hold of filenames, to avoid resizing, and to add any other features you need on the platforms you need to support.
If you create features that you think others may want, then mvx would love to see them open sourced back to the community - but that's not priority 1 - instead, the most important thing is making your app awesome and shipping it.

dynamically creating a diagram/layout

So I just got an internship at this company, and as a side project, they want me to redesign one of their webpages. On their webpage, they have an image like the following:
Basically, this is an image of a room layout, with different server boxes (white squares) used for testing. When you click on one of the white boxes, it will hyperlink you to a page that has to do with that server box and so forth. The issue is that if they redesign the room, or add server boxes etc, they need to remake a new image, and then change quite a bit of coordinates in a badly written perl script. (I thought this was a bad way to do things, and I recommended trashing the entire image idea in the first place, but they wanted to keep it). Anyway, is there an easier way to do this with code, so that if changes need to be changed, it only involves adding/subtracting lines of code? I was thinking of using some sort of html/css combination, but I don't know if there is a better way to go about doing this... I want to make there diagram a bit more dynamic.
Thank you.
Image Magick is often installed on web servers. Have a look at http://www.imagemagick.org/script/perl-magick.php

Optical character recognition

Hey everyone,
I'm trying to create a program in Java that can read numbers of the screen, and also recognise images on the screen. I was wondering how i can achieve this?
The font of the numbers will always be the same. I have never programmed anything like this before, but my idea of how it works is to have the program take a screenshot, then overlay the image of the numbers with the section of the screenshot image and check if they match, repeating this for each numbers. If this is the correct way to do this, how would i put that in code.
Thanks in advance for any help.
You could always train a neural net to do it for you. They can get pretty accurate sometimes. If you use something like Matlab it actually has capabilities for that already. Apparently there's a neural network library for java (http://neuroph.sourceforge.net/) although I've never used it personally.
Here's a tutorial about using neuroph: http://www.certpal.com/blogs/2010/04/java-neural-networks-and-neuroph-a-tutorial/
You can use a neural network, support vector machine, or other machine learning construct for this. But it will not do the entire job. If you do a screen shot, you are going to be left with a very large image that you will need to find the individual characters on. You also need to deal with the fact that the camera might not be pointed straight at the text that you want to read. You will likely need to use a series of algorithms to lock onto the right parts of the image and then downsample it in a way that size becomes neutral.
Here is a simple Java applet I wrote that does some of this.
http://www.heatonresearch.com/articles/42/page1.html
It lets you draw on a relatively large area and locks in on your char. Then it recognizes it. I am using the alphabet, but digits should be easier. The complete Java source code is included.
One simpler approach could be to use template matching. If the fonts are same, and/or the size (in pixels)is known, then simple template matching can do the job for you. ifsize of input is unknown, you might have to create copies of images at different scales and do the matching at each scale.
One with the extreme value(highest or lowest depending on the method you follow for template matching) is your result.
Follow this link for details

Image manipulation in ActionScript 3.0 : realistically editing faces

I am a flash developer who has worked mostly on small ActionScript projects, in particular websites, but I am dipping my toes into image manipulation with AS3. I have a project I'm working on to develop an application which would allow a user to upload their own picture into a swf, and then, using a slider, they can alter the image to make themselves look thinner or fatter. The condition is that it should require minimal user input - so ideally the most I could expect from the user would be a couple of control points identifying certain areas of the face in response to prompts e.g. 'click on the centre of the chin' and when the user clicks, the position would be stored, but this would need to be used sparingly, if at all.
So far, I have been able to use the FileReference class to handle the upload, and I am experimenting with using the DisplacementMap filter to edit certain parts of the uploaded image, but I am having serious trouble implementing this in a manner that would allow realistic deformation of the facial features in the image uploaded.
Is there anything that exists that might run along the same lines and that provides an explanation/source code I could look at to get a better idea of how to go around doing this? Or if there are any other ideas on how to manipulate and distort the image that doesn't use the DisplacementMap Filter?
Any feedback and help is greatly appreciated. Thank you for your time.
see http://sakri.net/technology/flash/flex/convolution_filter/ConvolutionFilterExplorer.html
(source code available)