image-manipulation

How can i crop image using C#

二次信任 提交于 2019-12-05 01:34:10
问题 I have a picture of document taken from camera. Now what i have to do is crop only document from that image . Please can anyone suggest me how best it can be done or first is it possible or not Edit For more information .. my next question How to get edge coordinates of a image? 回答1: If you know the area that contains the image data you would like to crop, you could use this article from MSDN: http://msdn.microsoft.com/en-us/library/ms752345.aspx If you need to find the relevant area before

Need PhotoBooth Mac feature in iphone app

北城余情 提交于 2019-12-04 20:40:26
Have a look on following application http://itunes.apple.com/us/app/fatbooth/id372268904?mt=8 i think they are using the same feature provided my PhotoBooth MAC. Please suggest any api or any other possible solution so that I can build an iphone application Thanks Core Image (certainly used by Photo Booth on the Mac) is not a public API on the iPhone. To achieve something similar, you would have to use OpenGL and write your own shaders (or do something like OpenGL mesh distortion). 来源: https://stackoverflow.com/questions/3829395/need-photobooth-mac-feature-in-iphone-app

How to Improve my php image resizer to support alpha png and transparent GIFs

人盡茶涼 提交于 2019-12-04 20:33:33
I use this function to resize images but i end up with ugly creepy image with a black background if it's a transparent GIF or PNG with alpha, however it works perfectly for jpg and normal png. function cropImage($nw, $nh, $source, $stype, $dest) { $size = getimagesize($source); $w = $size[0]; $h = $size[1]; switch($stype) { case 'gif': $simg = imagecreatefromgif($source); break; case 'jpg': $simg = imagecreatefromjpeg($source); break; case 'png': $simg = imagecreatefrompng($source); break; } $dimg = imagecreatetruecolor($nw, $nh); switch ($stype) { case "png": imagealphablending( $dimg, false

Getting a incorrect picture output when running my self-made rotation algorithm

ぃ、小莉子 提交于 2019-12-04 17:36:26
In order to better understand how image manipulation works, I've decided to create my own image rotation algorithm rather than using cv2.rotate() However, I'm encountering a weird picture cropping and pixel misplacement issue. I think it may have something to do with my padding, but there may be other errors import cv2 import math import numpy as np # Load & Show original image img = cv2.imread('Lena.png', 0) cv2.imshow('Original', img) # Variable declarations h = img.shape[0] # Also known as rows w = img.shape[1] # Also known as columns cX = h / 2 #Image Center X cY = w / 2 #Image Center Y

How to composite several NSImages into one big image?

左心房为你撑大大i 提交于 2019-12-04 16:29:40
问题 I have a collection of objects which describe an image-name, its size and it's X/Y location. The collection is sorted by "layers", so I can composite the images in a sort of painter's algorithm. From this, I can determine the rectangle necessary to hold all of the images, so now what I want to do is: Create some sort of buffer to hold the result (The NS equivalent of what iPhoneOS calls UIGraphicsContext.) Draw all the images into the buffer. Snag a new NSImage out of the composited result of

Resize an image and fill gaps of proportions with a color

南楼画角 提交于 2019-12-04 15:52:24
问题 I am uploading logos to my system, and they need to fix in a 60x60 pixel box. I have all the code to resize it proportionately, and that's not a problem. My 454x292px image becomes 60x38. The thing is, I need the picture to be 60x60, meaning I want to pad the top and bottom with white each (I can fill the rectangle with the color). The theory is I create a white rectangle, 60x60, then I copy the image and resize it to 60x38 and put it in my white rectangle, starting 11px from the top (which

PHP/JS - Create thumbnails on the fly or store as files

ぐ巨炮叔叔 提交于 2019-12-04 15:21:05
For an image hosting web application: For my stored images, is it feasible to create thumbnails on the fly using PHP (or whatever), or should I save 1 or more different sized thumbnails to disk and just load those? Any help is appreciated. Save thumbnails to disk. Image processing takes a lot of resources and, depending on the size of the image, might exceed the default allowed memory limit for php. It is less of a concern if you have your own server with only your application running but it still takes a lot of cpu power and memory to resize images. If you're considering creating thumbnails

Canvas - flip half the image

▼魔方 西西 提交于 2019-12-04 15:15:18
I have some image data in canvas, and now I need to take the left half of the image, flip it and apply it to the right, like a mirror effect. Example , from this: To this: I got this far (I have the image data ready): ctx.drawImage(this, 0, 0, 960, 540); var imgData = ctx.getImageData(0,0,960,540); // loop through the data and apply mirror ?? Width & height is known. Any ideas? Loop through the image data If the current pixel is in the left half of the image, copy it to a position on the right: for(var y = 0; y < height; y++) { for(var x = 0; x < width / 2; x++) { // divide by 2 to only loop

LockBits Performance Critical Code

﹥>﹥吖頭↗ 提交于 2019-12-04 14:51:47
I have a method which needs to be as fast as it possibly can, it uses unsafe memory pointers and its my first foray into this type of coding so I know it can probably be faster. /// <summary> /// Copies bitmapdata from one bitmap to another at a specified point on the output bitmapdata /// </summary> /// <param name="sourcebtmpdata">The sourcebitmap must be smaller that the destbitmap</param> /// <param name="destbtmpdata"></param> /// <param name="point">The point on the destination bitmap to draw at</param> private static unsafe void CopyBitmapToDest(BitmapData sourcebtmpdata, BitmapData

How to scroll and zoom in/out large images on iPhone?

ぃ、小莉子 提交于 2019-12-04 14:13:50
I have a large image, size around 30000 (w) x 6000 (h) pixels. You may consider it's like a big map. I assume I need to crop it up into smaller tiles. Questions: what are the right ViewControllers to use? ( link ) what is the tile strategy? (I put this in another question, as it's not iPhone specific) Requirements: whole image (though cropped) can be scrolled up/down/left/right by swipes zoom in (up to pixel-to-pixel) out (down to screen-fit-by-height) by the 2-finger operation memory efficiency by lazy loading tiles Bonus requirements: automatic scroll, say from left to right slowly and