image-manipulation

How to get the file size of a “System.Drawing.Image”

℡╲_俬逩灬. 提交于 2019-11-28 22:49:23
I am currently writing a system that stores meta data for around 140,000 ish images stored within a legacy image library that are being moved to cloud storage. I am using the following to get the jpg data... System.Drawing.Image image = System.Drawing.Image.FromFile("filePath"); Im quite new to image manipulation but this is fine for getting simple values like width, height, aspect ratio etc but what I cannot work out is how to retrieve the physical file size of the jpg expressed in bytes. Any help would be much appreciated. Thanks Final solution including an MD5 hash of the image for later

iPhone: Blur UIImage

别等时光非礼了梦想. 提交于 2019-11-28 21:41:17
In my iPhone application I have a black-and-white UIImage . I need to blur that image (Gaussian blur would do). iPhone clearly knows how to blur images, as it does that when it draws shadows . However I did not found anything related in the API. Do I have to do blurring by hand, without hardware acceleration? dom Try this (found here ): @interface UIImage (ImageBlur) - (UIImage *)imageWithGaussianBlur; @end @implementation UIImage (ImageBlur) - (UIImage *)imageWithGaussianBlur { float weight[5] = {0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 0.0162162162}; // Blur horizontally

Java - I need a very fast image scaling algorithm

浪子不回头ぞ 提交于 2019-11-28 21:40:27
I am working on a Midlet application. I am finding myself in the need to scale images very often. This has become a problem because some phones are pretty slow and scaling takes too long. Currently I'm using Image.createRGBImage(int, int, int, boolean) to scale the image. I was wondering if any of you knew of a very efficient and fast way to scale an image. Note: this is a Midlet application so only JavaME is available, meaning I don't have access to some other libraries available in the full java version. Note2: most of my scaling is done from small to large images, although I also do scale

Image downsampling algorithms

纵饮孤独 提交于 2019-11-28 21:17:49
问题 What's the best re-sampling algorithm I can use to divide an image into half its original size. Speed is of primary importance but it shouldn't degrade quality too bad. I'm basically trying to generate an image pyramid. I was originally planning to skip pixels. Is this the best way to go? From what I've read the image produced by pixel skipping is too sharp. Could someone who has tried this comment. My images contain map data sort of like this. 回答1: Skipping pixels will result in aliasing,

Looking for fast image distortion algorithms

最后都变了- 提交于 2019-11-28 20:57:32
I am trying to implement an application which uses shpere distortion filter. I am using an the algorithm from here which changes pixels location by getPixel() and setpixel() methods. My problem is it is too slow for Android devices and there are applications which implements same sphere(and others) filter way faster than my approach. ( for example Picsay Pro app) Could anyone share or give direction to find or implement fast distortion algorithms. Actual filter that implements the algorithm: public boolean sphereFilter(Bitmap b, boolean bSmoothing) { int nWidth = b.getWidth(); int nHeight = b

Merge two images to create a single image in C#.Net

本秂侑毒 提交于 2019-11-28 19:20:28
I have a requirement wherein I need to merge two different png/jpeg images resulting into a single image using C#.Net. There will be a particular location defined on the source image wherein I need to insert another image. Can anybody suggest some links ? This method merge two images one in the top of the other you can modify the code to meet for your needs: public static Bitmap MergeTwoImages(Image firstImage, Image secondImage) { if (firstImage == null) { throw new ArgumentNullException("firstImage"); } if (secondImage == null) { throw new ArgumentNullException("secondImage"); } int

How do I equalize contrast & brightness of images using opencv?

杀马特。学长 韩版系。学妹 提交于 2019-11-28 18:26:28
I've got an image that I've scanned, but the white paper is not white on the screen. Is there a way to equalize the contract/brightness to make the background whiter? Update I've tried the suggested Image._EqualizeHist function from EmguCv: string file = @"IMG_20120512_055533.jpg"; Image<Bgr, byte> originalColour = new Image<Bgr, byte>(file); Image<Bgr, byte> improved = originalColour.Clone(); improved._EqualizeHist(); But get an even worse result (also when first gray scaled): Am I missing other parameters? Abid Rahman K I have discussed some techniques here : How can I adjust contrast in

Find known sub image in larger image

元气小坏坏 提交于 2019-11-28 17:35:15
Does anyone know of an algorithm (or search terms / descriptions) to locate a known image within a larger image? e.g. I have an image of a single desktop window containing various buttons and areas (target). I also have code to capture a screen shot of the current desktop. I would like an algorithm that will help me find the target image within the larger desktop image (what exact x and y coordinates the window is located at). The target image may be located anywhere in the larger image and may not be 100% exactly the same (very similar but not exact possibly b/c of OS display differences)

Memory efficient image resize in Android

女生的网名这么多〃 提交于 2019-11-28 16:54:49
I am trying to reduce the size of images retrieved form the camera (so ~5-8 mega pixels) down to one a a few smaller sizes (the largest being 1024x768). I Tried the following code but I consistently get an OutOfMemoryError . Bitmap image = BitmapFactory.decodeStream(this.image, null, opt); int imgWidth = image.getWidth(); int imgHeight = image.getHeight(); // Constrain to given size but keep aspect ratio float scaleFactor = Math.min(((float) width) / imgWidth, ((float) height) / imgHeight); Matrix scale = new Matrix(); scale.postScale(scaleFactor, scaleFactor); final Bitmap scaledImage =

Resize an image with Paperclip

一世执手 提交于 2019-11-28 15:37:58
问题 The Paperclip plugin for Rails has a resize option that keeps the image in proportion. According to Ryan Bates' Paperclip Railscast, to make sure that option is on, you have to add a greater-than sign in the end of the size for the style you're looking to resize, as such: :styles => { :small => "160x160>" } I'm looking for Paperclip to resize my image to an exact size, even if that means it being out of proportion, so I figured that removing the greater-than sign would do the trick, as such: