image-manipulation

How can I save an altered image in MATLAB?

江枫思渺然 提交于 2019-11-26 07:46:16
问题 I want to read an image into MATLAB, draw a rectangle on it, and then save the image. Also, I\'m just learning MATLAB--please be gentle. It seems like it should be simple, but I can\'t seem to do it. im = imread(\'image.tif\'); imshow(im); rectangle(\'Position\', [100, 100, 10, 10]); imwrite(im, \'image2.tif\'); Even though I can see the rectangle on the image, the saved image does not display the rectangle. How can I save the image and have the rectangle show up? FWIW, I\'ve already tried

Flood fill using a stack

帅比萌擦擦* 提交于 2019-11-26 07:43:46
问题 I am using the recursive Flood fill algorithm in Java to fill some areas of a image. With very small images it works fine, but when de image becomes larger the JVM gives me a Stack Over Flow Error. That\'s the reason why I have to reimplement the method using a Flood Fill with my own stack. (I read that\'s the best way to do it in these kind of cases) Can anyone explain me how to code it? (if you don\'t have the code at hand, with the pseudo-code of the algorithm will be fine) I\'ve read a

Getting image dimensions without reading the entire file

只愿长相守 提交于 2019-11-26 01:44:52
问题 Is there a cheap way to get the dimensions of an image (jpg, png, ...)? Preferably, I would like to achieve this using only the standard class library (because of hosting restrictions). I know that it should be relatively easy to read the image header and parse it myself, but it seems that something like this should be already there. Also, I’ve verified that the following piece of code reads the entire image (which I don’t want): using System; using System.Drawing; namespace Test { class

Get average color of image via Javascript

亡梦爱人 提交于 2019-11-26 00:27:02
问题 Not sure this is possible, but looking to write a script that would return the average hex or rgb value for an image. I know it can be done in AS but looking to do it in JavaScript. 回答1: AFAIK, the only way to do this is with <canvas/> ... DEMO V2 : http://jsfiddle.net/xLF38/818/ Note, this will only work with images on the same domain and in browsers that support HTML5 canvas: function getAverageRGB(imgEl) { var blockSize = 5, // only visit every 5 pixels defaultRGB = {r:0,g:0,b:0}, // for

Cropping an UIImage

吃可爱长大的小学妹 提交于 2019-11-25 22:30:10
问题 I\'ve got some code that resizes an image so I can get a scaled chunk of the center of the image - I use this to take a UIImage and return a small, square representation of an image, similar to what\'s seen in the album view of the Photos app. (I know I could use a UIImageView and adjust the crop mode to achieve the same results, but these images are sometimes displayed in UIWebViews ). I\'ve started to notice some crashes in this code and I\'m a bit stumped. I\'ve got two different theories

Getting image dimensions without reading the entire file

一笑奈何 提交于 2019-11-25 18:51:21
Is there a cheap way to get the dimensions of an image (jpg, png, ...)? Preferably, I would like to achieve this using only the standard class library (because of hosting restrictions). I know that it should be relatively easy to read the image header and parse it myself, but it seems that something like this should be already there. Also, I’ve verified that the following piece of code reads the entire image (which I don’t want): using System; using System.Drawing; namespace Test { class Program { static void Main(string[] args) { Image img = new Bitmap("test.png"); System.Console.WriteLine