is there a way to grab a screen capture of a specific section of the screen and compare it to another image already store in disk. And if the image is identical, it would prompt something.
If you are trying to compare an image (or part of it) with another images, I searched internet and found that leadtools has correlation functions that compare an image with all the areas of the same dimensions in another image. For more information, see this link: http://www.leadtools.com/help/leadtools/v175/dh/po/leadtools.imageprocessing.core~leadtools.imageprocessing.core.correlationcommand.html
OR
This project may be what you're looking for:
https://github.com/cameronmcefee/Image-Diff-View-Modes/commit/8e95f70c9c47168305970e91021072673d7cdad8
Check http://www.developerfusion.com/code/4630/capture-a-screen-shot/ for examples on how to capture the screenshot.
The image comparison is a lot more complicated. The image that is stored on disk might have a different size, a different aspect ratio, or a different depth. Unless you can be sure that the screenshot and the image on the disk are absolutely identical, you'll have to look at a method that identifies similar images.
Take a look at the pHash Demo, which takes two images and outputs a similarity score. The algorithm it uses is pretty straightforward, and is available on the website.
Related
I'm currently trying to figure out how JPEG's are made in depth out of interest. I found documents on the different sections (soi, sof, sos, eoi etc) which are pretty straight forward, but not how to get a single pixel out of there.
My first thought was to make a small image, 2x2 for example, but with all the headers and sections it's still to big to isolate the pixel information without knowing the exact location and method to extract it. I'm sure it's compressed, but is their a way to get it out manually? (as RGB?)
Anyone has a clue on how to do this?
Getting the value of a single pixel of a JPEG image requires parsing some (if not most) of those sections anyway.
There's a good step-by-step guide available at https://www.imperialviolet.org/binary/jpeg/ (though the code is in Haskell, so it might be moderately inscrutable to mere mortals) that explains the concepts behind turning a JPEG into a bunch of RGB values.
This is the only source I know that explains JPEG end-to-end:
https://www.amazon.com/gp/product/B01JXRY4R0/ref=dbs_a_def_rwt_bibl_vppi_i4
Parsing the structure of a JPEG stream is easy. Decoding a JPEG scan is very difficult and involves several compression steps. Plus there are two different types of scan that are commonly in use (progressive & sequential).
Say for example that you have a 30,000 x 30,000 image, but at any given time you would only need a specific section of it that is for example 512 x 512.
Is there a way (or framework) to iterate or query for the pixels you are looking for without having to load the entire image into memory first?
Check out Microsoft's DeepZoom. A good primer is here.
DeepZoom accomplishes its goal by partitioning an image (or a
composition of images) into tiles. While tiling the image, the
composer also creates a pyramid of lower resolution tiles for the
original composition.
You can download the DeepZoom composer here.
Also check out OpenSeadragon for a JavaScript solution.
It depends.
If your image is a jpeg/png, when you load a part, all must be loaded (because of compression)
If the image is a bmp, you can create your own load, because is a disk bitmap.
My advice is to create separate images of 512x512 and load separately (it's what google maps do!)
i'm using c# tessnet2 wrapper for Tesseract OCR engine to capture chracters of image files. i been searching everywhere if tessnet2 has any build in functions to overwrite certain characters and saved them into the same image file it's reading but have not found anything in regards to that. so what i'm thinking of doing is creating a new imagine file base on what i'm receiving from tessnet2 but i need to create the new image the same exact way but change just few things in the new created image. i'm not sure if i'm using the correct methology or if there is other c# assemblies out there that allow you to read characters from image file and at the same time allow you to manipulate as you need them.
Good luck--but tess has no way of replacing in the proper font. Raster graphics don't generally store glyph information. Even if it did, you would potentially be in violation of licenses and/or copyrights surrounding the fonts you'd be writing in. I'm not an expert in OCR, but I will confidently say that this is something not readily available out there in the wild.
To expand on Brian's answer:
You will need to do this yourself. I have not worked with Tesseract, but I have used the Nuance OCR engine. It will return you font information as well as coordinates for the character it has recognized (note that you will most likely have to compute the actual image coordinate as the OCR engine will have deskewed the image before performing the recognition). Once you get the coordinates and the deskew so that you can compute the actual coordinate, you can then use any image manipulation library (Leadtools, Accusoft, etc) or just straight GDI+ functions to clear the character, then using the font info and size info create a new character and merge it into the image. This is not trivial but certainly doable.
Edit:
It was late when I wrote the initial answer, wanted to clarify what is meant by font information. The OCR engine will give you information regarding the point size, whether its bold/italicized and the font family (Seriph, etc). I do not know of one that will tell you the exact font that the document is in. If you have a sample of the documents that you will process, then you can make a good guess based on the info the OCR engine gives you.
I am trying to load a large image ( size > 80 MB) into web page. User doesn't really need to see the whole image at once and only need to see the requested portion.
The dimensions of the image are approx 10k x 10k.
I looked around a little bit but couldn't found a reasonable solution to the problem.
I would like to split the image into some amount of pieces as needed (for ex 9 pieces, 3k x 3k each) and load them into the page as user request or moves into next section of the image (ex. if user crosses 3k x 3k boundary, server will send side or bottom piece as needed).
I did found ways how to split image but couldn't find a way to do that dynamically and sew them together dynamically.
UPDATE
I tried using Microsoft Deep Zoom Composer but it didn't work. I think it does not support such large image size. I came to that conclusion as I tried the same image in Microsoft PhotoSynth and got an error message that it only supports files up to 32MB. Deep Zoom Composer and Photo Synth use same file format so I think they might have same file size constraints.
Deep zoom Composer didn't produced meaningful error message as the error message was, file format is not right, but file is in right format (i.e. jpg).
Thanks
You could use Microsoft Deep Zoom Composer
Since that is a rather large image to display I am going to assume you cannot size it to more manageable dimensions and you have to show it in some grid. You could use the same idea as Google Maps where you load the blocks individually as the user moves across the view.
How you are going to structure that view will be up to you since even 3k x 3k pixels is somewhat larger than most screen resolutions. You may want even smaller blocks.
I don't know of any component off-hand to do what you require but rolling your own shouldn't be too difficult. You could use some container div with the grid divs arranged inside and as each comes into view you load the background image bit or you could render a fixed number of divs as your grid and load the necessary background images as your "viewport" moves.
Hope that makes sense.
I think that you should convert it to another file format, for example bmp, so you can easyly navigate in the file to the needed pixels, compose a new image with those pixels and send it, or save it and reerence it. The big problem would be the new image size.
Can I compare 2 images and show the difference using C#?
How?
Sure you can. One (slow) way to do so would be to create a new empty image and then use GetPixel and SetPixel to construct the difference image.
Could be useful perform an image substraction (maybe better in GrayScale mode) as shown here:
How to subtract one bitmap from another in C#/.NET?
There is technology called SIFT( Scale Invariant Feature Transform ).This algorithm generates a feature file from an image in which it has salient points of that Image. This file is called SIFT feature.
You have to generate the SIFT feature file for the images that you want to compare. Then this technology has a matching function which you can use to compare the feature files. This function returns a number. the higher the number the more similar the images. in this way you find the most similar images from within a set.