How to compare two images by pixel using selenium C# - c#

I have two screenshots. One is expected, another one is actual. I was looking for a good way to compare those screenshots using C# for my automated selenium tests. I found a few decisions to do that in java but C# doesn't provide a lot. I'd appreciate any help

You can use ImageMagick a 3rd party application. It supports command line calls to do image comparison. The following link discusses how to use the command line call:
http://techblog.hotwire.com/2016/05/19/image-comparison-in-automated-testing/
You can also use the nuget package for ImageMagick. This would allow you to embed C# calls to the nuget library in your .NET application. The following stack overflow answer discusses it:
https://stackoverflow.com/a/14235661/2683997
Both of these links assumes that you have been able to do the image capture part already.

You can do this by sikuli with selenium web driver

Related

FFmpeg library in WPF

I am building a softwere that can decode and encode using Wpf and c#, and I want to do that using, FFmpeg libary. I saw the ffmpeg autogen warpper but I couldn't find any documantion for its function.
Can someone please find me one? Or better, give me better warrper.
I already tried FFMpegCore, its working but very slow. For Exaple it takes 20 seconds to decode a specific frame.(And i have monstruos computer)
If will be happy if ou could give me better warpper, or a guide for ffmpeg.autogen.
Thanks in advance.
FFmpeg framework is powerful, from the other hand is so large which makes it complex. If you want to mess with it, you will have to read a lot before start coding. I would recommend starting with the original documentation and examples that can be found here :-
FFmpeg Libraries Documentation
FFmpeg C Examples
And then move to some open source examples -based on what you want- coded in C# with FFmpeg.Autogen bindings.
You can check my recent FFmpeg.cs implementation that is for decoding (audio/video/subtitle frames).
FFmpeg.Autogen C# Example
I've been building my own media player to cater for my needs and I'm using
Flyleaf:https://github.com/SuRGeoNix/Flyleaf which is based on FFMPEG. There are samples in the code to get you started.
I've also seen this: FFME: https://github.com/unosquare/ffmediaelement

How to automate testing in weka?

My C# program generates both training and testing data. I need to use Back Propagation Neural Network/ Multilayer perceptron in Weka GUI for classification & testing. Currently I'm supplying the testing data manually.
As my C# program generates test data, this has to be supplied automatically to the Multilayer perceptron in the weka. This is a Kinect application written in C#.
Is there a solution for automatic testing of data using weka?.
So that my application works without my manual intervention.
Thanks in advance.
Weka has a Java API that that can be used to access the majority of the features exposed in the GUI. Plenty of documentation is available on their website. A good starting point is this guide to using WEKA in Java Code.
The problem here is to link C# code with Weka(Java). For this, I found CSharpJavaMerger. But we need to get the source code of Weka which is in Java, use the merger software for converting and thus link it to C# code.

PHP (HTML5) based Windows Software

Is it possible to make from a HTML5-APP (PHP,SQLITE,HTML,CSS,JS) a installable Windows Software in c#?
The software must start PHP (5.4), and must just load the document-root in the webbrowser object.
In theory it should work without problems. But what about protecting this code? Is it possible to protect at least the PHP part? Will ioncube or zend-guard work on PHP 5.4's embeded server? And is it possible to hide the shell window, which will open everytime, when i start the PHP Webserver via cmd?
Or do you know an alternate, how i can make a software from a HTML-5 (with PHP) App?
Your choosing the wrong language. PHP, HTML, JS, CSS and SQLLite are separate technologies.
I'd suggest writing the app in another language capable of producing an executable like C / C++ (and one that can plug into to SQLITE fairly easy).
If you want to create a installer out of HTML5-APP (PHP,SQLITE,HTML,CSS,JS) , take a look at bitnami package, it may solve your problem, if you have any explicit reason to use C#, and then you have see its library or namespace which may give you installer capability. However your question is unclear, can be be more clear?
You can embed a Chrome browser in C# using the CefSharp project. You would also need to embed some webserver (php built-in webserver might work, but it's single threaded so it might be an issue).
If it doesn't necessarily need to be C#, then take a look at the PHP Desktop project that is using C++ to embed a Chrome engine, a multithreaded webserver Mongoose and a PHP interpreter. Sources can be protected using many available php encoders, see the KnowledgeBase wiki page on the project site for details.

Capture Image using Microsoft LifeCam and C#

I have a Microsoft LifeCam and I want to Capture image using C# and use the image inside my application.
I have checked A previously asked question in SO but the link provided in first answer to OpenCV looks to be invalid ( I get "FORBIDDEN" response ).
I want to know if there is any Sample that I can use to learn and capture Image from LifeCam? And also I need the dll (s) for this.
Does anyone have any experience in this case?
Thanks to Sascha, ESCAPI Solution really helped, I used the ESCAPI.dll along with the C# wrapper to translate it to C# and it all went well.

Using Mapnik in .net environment

Has anybody used Mapnik for rendering Maps from .net c# environment? I would like to use it to render maps in a desktop application developed under .net4. I found it the best open source map renderer tool, much more better, than the well known sharpmap, dotspatial (...). The 'only' problem is that it was written in C++ and Python and does not have a trivial way to use it from C#.
Do you know any .net Mapnik wrappers? Do you know any sample code?
I've just published my attempts in C# bindings.
They are available at: http://sourceforge.net/projects/mapniknet/
Some good new about Mapnik-.Net integration:
"Another thing that will help Windows developers is a way to use Mapnik from .Net languages. Although a full .Net wrapper is too much work besides all the other issues, hopefully I can make a meaningful start and open the door for .Net developers to leverage Mapnik in their applications."
Source: Mapnik homepage http://mapnik.org/news/2011/jun/09/gsoc_2011_windows_build_system_introduction/
NET-Mapnik
You might want to give this a try. Its pretty recent and has a simple example with options to create vector tiles.
https://github.com/kernelsanders/NET-Mapnik
So, finally I hacked it. Not a nice solution, but it works at least. In nutshell it operates in the following way:
developed a python script, which takes parameters as command line arguments. (using python api of mapnik)
call this python script by shell fom c# code (Process)
after map image has been generated, I show it in SharpMap as a background layer
In case of any map refresh (zoom, pan) I regenerate 'mapnik map layer'. I have also some kind of cache, in which I can store generated maps, so I can make tricks by using earlier generated map images or pre-generate them (e.g. generate maps for the next zoom level when user uses zoom tool). I also use some asynchron calls to do this, so I can create 1-3 map images paralelly.
The weak part of this solution is the communication between python and c# modules. I could not find better than command line arguments + shell.
My solution works, mapnik is fast, can genarate my maps less than a sec.
If you have any advice on .net - python communication (NO ironpython, it is not suitable for manik api), pls write it here. Thx.
Do you know about TAO Project?
It is a .Net project that takes unmanaged opengle library to .Net Managed Form by calling DllIMport() in C#.
You must do it for Mapnik, simaliar to TAOFramework.net

Categories

Resources