i want to compare two images like image1.png and image2.png.both the images look pretty same with some difference. so i want to get the difference and want to apply the difference on first image image1.png. i searched lot to get similar kind of code of this library but found none.
after lots of search i got bit similar kind of things which i am looking for in java code. here is the url http://mindmeat.blogspot.in/2008/07/java-image-comparison.html
please go to the url and there you can see the code generate 3rd image with difference but my requirement is bit different. i do not want to generate 3rd image rather i want to apply the difference on the 1st image image1.png. some one told me it can be done very easily with emgu cv library. so i search for similar code based on emgu cv library but found no. it will be great help me anyone can guide me with sample code using emgu cv library.
thanks
I think what you require is:
image1 = image2 - image1;
Due to operator overloading, this is possible directly in Emgu CV
Related
I've got some C# code in Unity that grabs a large image from my Android Device's filesystem, and now with it I want to use it to create a small thumbnail image.
I've found lots of different suggestions for how to do this such as the following:
MemoryStream outputStream = new MemoryStream();
System.Drawing.Image image = System.Drawing.Image.FromFile(originalImagePath);
System.Drawing.Image thumbnail = image.GetThumbnailImage(thumbnailWidth, thumbnailHeight,()=>false, IntPtr.Zero);
thumbnail.Save(outputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
return outputStream;
However, as with the above method, all of the methods I've found require you to use the System.Drawing namespace. And I can't for the life of me get the functions in this namespace to work on Android, because even after adding "System.Drawing.dll" into the Assets folder, I get an error saying that it can't locate "gdiplus.dll" on construction of "System.Drawing.Image". I tried downloading and adding said "gdiplus.dll" to Assets, but I just get the same error as if it can't find it!
I don't understand why its so hard to get the System.Drawing functions working in Unity, but that's somewhat besides the point, as all I really want to do is create a thumbnail of an image that lives on the user's Android Device. Any suggestions would be welcome!
EDIT: I forgot to mention that I'd like to avoid solutions that use Texture2D's because they can't be run off the main thread, and hence come with performance consequences =(
Thanks in advance! =)
Don't use Texture2D.Resize, because the resulting texture will become grey:
After resizing, texture pixels will be undefined.
See this post for other solutions.
Old answer
I recommend use an opensource C# image processing library, such as ImageSharp or search it on GitHub.
The last solution is to write one yourself, if the performance or size of a 3rd-party library is still not good enough.
Here are two ideas I can come up with:
split the possibly lengthy reading and resizing procedure into several Coroutines.
use multi-thread
You may also try calling java functions from Unity3D. But I'm not familiar with that.
I want to create my own Google Map like this:
My problem is that I can't load and edit my large images.
My Images:
PNG / JPG
700 MiB
300000px x 300000px
My attempts:
ImageMagick
.NET C# / BitmapImages ...
C++ / OpenCV
general image classes in Java and Python
With which language / library I can edit these big images.
I help maintain libvips, an image processing library designed to work with very large images. It's free and works on Linux, Mac and Windows. You can use it from the command-line, C#, C/C++, Python, Ruby and others.
You can make your google maps tiles from the command-line like this:
vips dzsave hugefile.tif myoutputdir --layout google
Or from Python (for example) like this:
import pyvips
image = pyvips.Image.new_from_file("somehugefile.tif", access="sequential")
image.dzsave("filename/of/pyramid", layout="google")
And it'll scan your huge tiff image and generate all the tiles. It's fast, it needs little memory and it'll work on images of any size. I regularly make 200,000 x 200,000 deepzoom images from microscope slides using my small laptop.
There's a chapter in the libvips docs introducing dzsave and explaining how to use it.
This is not a full answer, but I need a little more space than a comment can give.
Take a look at the large image support section on the ImageMagick or the discussion board.
This answer mentions the VIPS package which might be helpful.
You might also consider posting in photography stackexchange, or even blender stackexchange - for example I saw this answer which mentions writing individual image tiles - also here, although that question is about rendering. Blender is not specifically for image processing and editing, but it's pretty amazing and flexible and has a very active and supportive community. You can use python within Blender as well.
You could also think of asking in gis stackexchange.
When you post in the other stackexchanges, take a look around first and make sure you write your question so that it does not look too off-topic for that site.
Good luck - it seems tiling is everywhere!
I'm currently searching for a C# image recognition library.
What I want to do:
I want to write a function that scans an image and returns if another image is part of it. Or at least something that looks familiar in case that the angles of the two objects are different.
The link to a possible library and a short code example would be great!
Thank you in advance!
Since you didn't mention that you are only looking for free libraries, here are some paid ones:
MVTech HALCON
Cognex VisionPro
Both have demo versions and quite good .Net wrappers bundled to the SDK, and I think both have the functionality you need. In Halcon, you might want to try different matching algorightms (gray value based, descriptor based, etc.), while in VisionPro PatMax or PatQuick might suit your needs. But obviously you have to try which one is the best for your specific problem.
EmguCV (http://www.emgu.com/wiki/index.php/Main_Page) is a good .NET OpenCV wrapper. It has a bunch of sample projects bundled. Run samples and you will get the idea of what can be done and how.
The Accord.NET library is not actually an image recognition tool set, however it provides the base for what you are aiming for. It contains many Imaging classes required for building an image recognition system. Accord.NET is LGPL licensed, except for some parts of it (e.g. its FFmpeg wrapper project).
hi
I am developing a video capture application using C#.net. i captured
video through webcam and saved it as a JPEG images then i want to make a
wmv file with those images. how can i do that what are the basic steps needed for that can any body help
I am working on this myself. I have found two ways that may be possible - both require the purchase of an outside library.
The first one looks to be the easiest but costs the most, although it will allow you to use it for free you will just have to deal with a pop up telling you to purchase the library: http://bytescout.com/products/developer/imagetovideosdk/imagetovideosdk_convert_jpg_to_video.html
The other involves using Microsoft Encoder 4. I am still working on this one. You can get the free version here: http://www.microsoft.com/download/en/details.aspx?id=18974
C# doesn't natively support much in the way of sound or video so outside reference assemblies seem to be a necessity.
Right now that is the best help I can offer until I figure it out.
I have created a TIFF image from several lines of text, and it's quite large at 300DPI. The image itself looks pretty good. The font is set as followings when drawing the string to the image:
drawing.SmoothingMode = SmoothingMode.Default;
drawing.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault;
When I print the image, the text comes out fuzzy (I'm printing to a low-rez printer). But, if I take the exact same image and print it from Paint.NET, it prints beautifully. The difference is that when I hit Print in Paint.NET, it asks me if it should sharpen the image for printing -- when I say yes, that's when it works.
My question is what the heck is Paint.NET doing to sharpen the image and how do I mimic that? I will post some code later tonight to assist with an answer, if anyone has an answer.
Thanks!!
There is a .NET C# library called AForge.NET. It has many components and one of these components is an imaging library that does, indeed, have a sharpen filter (among many other types of filter). You can download the library here: http://code.google.com/p/aforge/
And if you need help on how to use it, look here: http://www.codeproject.com/KB/GDI-plus/Image_Processing_Lab.aspx