How to run a function on a specific area in mask image

Hi,
I'm trying to run a 2D gaussian function on a specific mask area but with no luck.
I use bwlabel command to select the first area:
[lab,num]=bwlabel(img2);
I=lab==1;
figure
imshow(I)
I have multiple mask area so if I want to apply the gaussian function for the first three area what I sould write? and how to apply the gaussian function?
Kind Regards,

Respuestas (1)

Image Analyst
Image Analyst el 12 de En. de 2021
Apply the blurring function to the whole image, then multiply the mask by the blurred image.

8 comentarios

Thanks for your reply, what I need is to apply different function for the region of interest; i have attached the mask image as I need to apply different code and function to the left column instead of apply one for whole image.
What code do you need to apply to the left column, and what code do you need to apply to the whole image?
I want to apply a 2d gaussian function on the left one and the right one I want to apply different function.
Thanks
Apply each blurring function in turn to the whole image, getting out separate results. Multiply each separate result by the mask appropriate to it. Add the results.
Thanks Walter is this applicable also if I need to run a normal density profile and histocount in each reigon?
if yes could you please help me with a short code to start with.
Thanks
I do not know what the calculations are for density profile.
For histogram, run the histogram on Image(Mask) since histograms do not care about the spatial order of the data.
"I want to apply a 2d gaussian function on the left one and the right one I want to apply different function." <== Wow, you're not making this easy are you? Not sure why
  1. you're not telling us the two functions
  2. there are two different functions
  3. you're not telling us if the image is gray scale or color, and
  4. you're not atttaching the image that is to be filtered
  5. you're delaying an answer by not giving us everything we need up front to help you.
Z998567
Z998567 el 13 de En. de 2021
Editada: Z998567 el 13 de En. de 2021
Hi, I really appreciate your help and I already said that I want to apply it on "2D gaussian function" which is a gray image see your quoted reply. similar to this https://www.mathworks.com/matlabcentral/fileexchange/9556-custom-2d-gauss
just to be cleared I want to know how to run any function if I have already mask region but I don't want to apply it to all of them I want to select 2 region or any specific number of masked region.
Thanks

Iniciar sesión para comentar.

Productos

Versión

R2020b

Etiquetas

Preguntada:

el 12 de En. de 2021

Editada:

el 13 de En. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by