Mapping image into cylinder or sphere shape?

The technique is called texture mapping. This is a code example from surface function (R2011b): load clown surface(peaks,flipud(X),… ‘FaceColor’,’texturemap’,… ‘EdgeColor’,’none’,… ‘CDataMapping’,’direct’) colormap(map) view(-35,45) This example loads RGB image from “peppers.png” and maps it onto cylinder: imgRGB = imread(‘peppers.png’); [imgInd,map] = rgb2ind(imgRGB,256); [imgIndRows,imgIndCols] = size(imgInd); [X,Y,Z] = cylinder(imgIndRows,imgIndCols); surface(X,Y,Z,flipud(imgInd),… ‘FaceColor’,’texturemap’,… ‘EdgeColor’,’none’,… ‘CDataMapping’,’direct’) colormap(map) view(-35,45) Things are … Read more

Matlab: How to bend line in image

Ok, here is a way involving several randomization steps needed to get a “natural” non symmetrical appearance. I am posting the actual code in Mathematica, just in case someone cares translating it to Matlab. (* A preparatory step: get your image and clean it*) i = Import@”http://i.stack.imgur.com/YENhB.png”; i1 = Image@Replace[ImageData[i], {0., 0., 0.} -> {1, … Read more

Merge two images in php

The best approach for this situation may be to create a new image in memory with the combined dimensions you desire, then copy or resample the existing images to the new image, and then save the new image to disk. For example: function merge($filename_x, $filename_y, $filename_result) { // Get dimensions for specified images list($width_x, $height_x) … Read more

Texture deforming, 4 points

OK, here we go. Implemented as a small, self-contained example where you can drag around the corners with the mouse: +1 to… tucuxi who already posted the basic approach in his answer MvG at math.stackexchange.com who described how to compute a projective transformation from 4 points Here’s the code: import java.awt.Color; import java.awt.Graphics; import java.awt.GridLayout; … Read more

How to remove repititve pattern from an image using FFT

Here is a simple and effective linear filtering strategy to remove the horizontal line artifact: Outline: Estimate the frequency of the distortion by looking for a peak in the image’s power spectrum in the vertical dimension. The function scipy.signal.welch is useful for this. Design two filters: a highpass filter with cutoff just below the distortion … Read more