Gaussian Blur for a Dot

2 次查看(过去 30 天)
Bill
Bill 2012-9-27
Hello all! I'm trying to do something very simple, but for whatever reason, I'm stumped. All I need to do is blur a dot on a screen. The size and color of the dot must be dynamic, as we'll be using different dots of different sizes and different colors. Also, the background of the dot must blend into the background of a figure. For example, let's say that I need a black dot on a white background. The white outline of the image must blend in perfectly with the white background of the rest of the screen. In other words, there can't be a noticeable border between where the image ends and the background begins.
Thanks so much!!!
Bill

回答(1 个)

Vidhi Agarwal
Vidhi Agarwal 2025-6-10
Hi @Bill,
The task of dynamically blurring a dot and ensuring the background blends seamlessly into the screen in MATLAB can be done cleanly using alpha blending and Gaussian filters.
The "AlphaBlender" System object combines two images, overlays one image over another, or highlights selected pixels.
Below are the steps that can help you in getting started:
  1. Set paramters and create a canvas.
  2. Draw the dot.
  3. Apply Gaussian Blur, use "fspecial('gaussian', size, sigma)" to create a blur kernel and then apply it with "imfilter" to each RGB channel to create a soft-edged blurred dot.
  4. Use "imshow" to show the final image.
Refer to the following documentation for alpha blender: https://www.mathworks.com/help/vision/ref/vision.alphablender-system-object.html
Hope this helps!

Community Treasure Hunt

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

Start Hunting!

Translated by