image-effects

Ripple effect in MATLAB

对着背影说爱祢 提交于 2021-01-27 08:29:28
问题 I want to write a function newim = rippleim(im) that takes an image and returns a new image with ripple effect on it. I thought calculating the distance of all points from (p,q) and then a multiplication of sin(d).*exp(-d) would give a good effect of fading waves. n = 800; m = 800; im = zeros(n,m,3); p = [round(m*.5) round(n*.5)]; [x y] = meshgrid(1:m,1:n); x = x - p(1,1); y = y - p(1,2); d = (x .^2 + y .^2).^.5; R = cos(.05*d) .* exp(-.005*d); G = cos(.05*d) .* exp(-.005*d); B = cos(.05*d) .

How to create mirrored image effect with CSS single element

ぃ、小莉子 提交于 2019-12-23 02:26:11
问题 I have an HTML element with a background image and want to create a mirror effect to the bottom, as if the image is reflected like this: The optimal solution for me to create this reflection would be CSS only without using more elements than this single one and without using the image URL multiple times (due to maintenance reasons). I only found solutions like this with "complicated" HTML markup. This is my code: div { position: relative; background: url(https://i.stack.imgur.com/P56gr.jpg);

Save animated warp as a GIF file in MATLAB

て烟熏妆下的殇ゞ 提交于 2019-12-12 06:36:44
问题 I could finally manage to get ripple effect. I animated it and want to save the animation to a GIF file. But I get a fixed image in the gif file. The animation works great in MATLAB but I don't know why it won't get saved. im = imread('peppers.png'); [m,n,~] = size(im); n = linspace(-4 * pi,4 * pi,n); m = linspace(-4 * pi,4 * pi,m); [X,Y] = meshgrid(m,n); d = (X .^ 2 + Y .^ 2) .^ .5; d = d / max(d(:)); d = (d - .5) * 2 * pi; j = 1; figure(1); for i = 0 : .2 : 2 * pi Z = cos(2 * d + i) .* exp(

How can I change the background color of the image?

落花浮王杯 提交于 2019-12-08 09:46:00
问题 I want to remove/change the background color of an image in Matlab. Anyone know how to do this? Here is an example image, I want to remove the green background color. (source: frip.in) 回答1: Simplest answer would be, c = [70 100 70]; thresh = 50; A = imread('image.jpg'); B = zeros(size(A)); Ar = A(:,:,1); Ag = A(:,:,2); Ab = A(:,:,3); Br = B(:,:,1); Bg = B(:,:,2); Bb = B(:,:,3); logmap = (Ar > (c(1) - thresh)).*(Ar < (c(1) + thresh)).*... (Ag > (c(2) - thresh)).*(Ag < (c(2) + thresh)).*... (Ab

Bitwise color filter in MATLAB

夙愿已清 提交于 2019-12-08 06:01:16
问题 Is there a MATLAB function that does the following: For an image input, it tells me what proportion of the bits are darker than a particular color of my choosing. So if I entered an image of a chess board and used the color gray, the output would be roughly one half. (the image I need to process in this way is not that simple, though) 回答1: function CompareMap = BitWiseCompare('filename',c) % c = [R , G , B]; A = imread('filename'); CompareMap = zeros([size(A,1),size(A,2)]); CompareMap = (A(:,