image-manipulation

PHP GD image perspective

我与影子孤独终老i 提交于 2019-11-27 02:58:45
问题 Hi is it possible to transform an images perspective... so it's new shape is an isosceles trapezoid? I saw a solution using imagemagick, but that would involve possibly rewriting my entire image manipulation script... (not to mention learning, of which i'm allergic) 回答1: GD does not support 3D image manipulations :( The solution using ImageMagick is not complex: http://valokuva.org/?p=112 回答2: I have improved the function that James have posted. Added: vertical / horizontal perspective

Inserting NSData into SQLite on the iPhone

人走茶凉 提交于 2019-11-27 02:55:34
问题 So far I've managed to create this method for inserting into a SQLite database on the iPhone: - (void) insertToDB :(NSString *)Identifier :(NSString *)Name { sqlite3 *database; if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) { char *sql1 = "INSERT INTO table VALUES ('"; const char *sql2 = [Identifier cStringUsingEncoding:[NSString defaultCStringEncoding]]; char *sql3 = "', '"; const char *sql4 = [Name cStringUsingEncoding:[NSString defaultCStringEncoding]]; char *sql5 = "'

Does UIImageView cache images?

天大地大妈咪最大 提交于 2019-11-27 02:22:26
问题 Probably I'm gonna ask the same question which was asked by other person (But it has no responses): Speed up first UIImageView animation (force cache the images) But, My short question is: I have 60 images in resources, in timeinterval loop I'm gonna animate that images, each time setting to UIImageView.image the n'th image from resouce. The problem is: first animation is bad! When I loop all images again in same UIImageView, animation is perfect. Can we pre cache images in UIImageView? EDIT:

OpenCV: how to rotate IplImage?

对着背影说爱祢 提交于 2019-11-27 01:42:49
I need to rotate an image by very small angle, like 1-5 degrees. Does OpenCV provide simple way of doing that? From reading docs i can assume that getAffineTransform() should be involved, but there is no direct example of doing something like: IplImage *rotateImage( IplImage *source, double angle); If you use OpenCV > 2.0 it is as easy as using namespace cv; Mat rotateImage(const Mat& source, double angle) { Point2f src_center(source.cols/2.0F, source.rows/2.0F); Mat rot_mat = getRotationMatrix2D(src_center, angle, 1.0); Mat dst; warpAffine(source, dst, rot_mat, source.size()); return dst; }

Manually alpha blending an RGBA pixel with an RGB pixel

烈酒焚心 提交于 2019-11-27 01:19:58
问题 I am trying to do an alpha blend operation of an RGBA image (foreground image), on to a RGB image (background image). However, while doing so I think I may be doing the wrong alpha blending operation or doing it wrong. For example, the pixel of my RGB image is a grayish color of (127, 127, 127). The pixel of my RGBA image for the pixel will be (0, 0, 255). After I do my blending operation, the final color will be (127, 0, 255). However, I thought that was more of an additive blend and

Tint image using CSS without overlay

喜欢而已 提交于 2019-11-27 00:52:42
问题 Is it possible to tint an image with a specific color using CSS without an overlay in a WebKit browser? Failed attempts Managed to tint the image sepia or an arbitrary color using hue-rotate but couldn't find a way to tint it with a specific color. Creating a "tint" SVG filter and calling it with -webkit-filter: url(#tint) doesn't work on Chrome. All possible combinations of opacity / box-shadow css properties with drop-shadow / opacity filters don't generate the desired effect. Ideas Given a

Change color of certain pixels in a UIImage

吃可爱长大的小学妹 提交于 2019-11-27 00:46:11
For a given multi-color PNG UIImage (with transparency), what is the best/Swift-idiomatic way to: create a duplicate UIImage find all black pixels in the copy and change them to red (return the modified copy) There are a few related questions on SO but I haven't been able to find something that works. You have to extract the pixel buffer of the image, at which point you can loop through, changing pixels as you see fit. At the end, create a new image from the buffer. In Swift 3, this looks like: func processPixels(in image: UIImage) -> UIImage? { guard let inputCGImage = image.cgImage else {

Bmp to jpg/png in C#

陌路散爱 提交于 2019-11-27 00:40:11
Is there any way to convert a bmp image to jpg/png without losing the quality in C#? Using Image class we can convert bmp to jpg but the quality of output image is very poor. Can we gain the quality level as good as an image converted to jpg using photoshop with highest quality? var qualityEncoder = Encoder.Quality; var quality = (long)<desired quality>; var ratio = new EncoderParameter(qualityEncoder, quality ); var codecParams = new EncoderParameters(1); codecParams.Param[0] = ratio; var jpegCodecInfo = <one of the codec infos from ImageCodecInfo.GetImageEncoders() with mime type = "image

Detecting hair in a portrait image?

只谈情不闲聊 提交于 2019-11-27 00:24:18
问题 What would be the best approach for detecting and removing a person's hair in a simple portrait image ? Any useful libraries of algorithms ? I have been looking over openCV which looks like it could be of some use 回答1: You're dealing with two different problems here: detecting if a face in a portrait has hair "removing" the hair The first is solvable fairly easily: Separate the face from the background (as you've mentioned a "simple portrait image", this shouldn't be too hard). Convert your

Proportional image resize

久未见 提交于 2019-11-27 00:04:30
问题 I'm having a little bit of a problem scaling my images to a properly predefined size. I was wondering - since it is purely mathematics, if there's some sort of common logical algorithm that works in every language (PHP, ActionScript, Javascript etc.) to scale images proportionally. I'm using this at the moment: var maxHeight = 300; var maxWidth = 300; var ratio:Number = height / width; if (height > maxHeight) { height = maxHeight; width = Math.round(height / ratio); } else if(width > maxWidth