Make an artificial silhouette of the spray given in image using sine function.

3 visualizzazioni (ultimi 30 giorni)
I would like to make a silhouette of the spray given in image using sine function. I should be able to change the phase angle on both the left and right sides.
  1 Commento
Image Analyst
Image Analyst il 8 Ago 2023
To get a binary image you can use imbinarize. I have no idea what you're talking about when you talk about sine and phase angles. What does that have to do with creating a silhouette?

Accedi per commentare.

Risposte (1)

Praveen Reddy
Praveen Reddy il 23 Ago 2023
Modificato: Praveen Reddy il 23 Ago 2023
Hi Edin,
I understand that you are trying to make silhouette of an image. You can use sine function as “amplitude * sin(frequency * x + leftPhaseAngle) to generate y-axis values with varying phase angles for silhouette.
sprayImage = imread('spray_image.jpg');
sprayImage = im2double(sprayImage);
amplitude = 0.5; % Adjust the amplitude as needed
frequency = 0.02; % Adjust the frequency as needed
leftPhaseAngle = pi; % Adjust the phase angle for the left side
rightPhaseAngle = 0; % Adjust the phase angle for the right side
x = 1:size(sprayImage, 2);
% Generate the y-axis values using the sine function with varying phase angles
y = amplitude * sin(frequency * x + leftPhaseAngle);
y = repmat(y, size(sprayImage, 1), 1);
% Apply the silhouette effect to the image using a smooth transition
silhouetteImage = sprayImage .* (1 - y) + y;
figure;
imshow(silhouetteImage);
By experimenting with different values for the parameter's amplitude, frequency, leftPhaseAngle, and rightPhaseAngle in the above code, you can customize the silhouette effect to achieve desired appearance.
To know more about creating a silhouette from an image, please refer to the following MATLAB answer
Hope this helps!

Prodotti


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by