How can I filter region of interest (ROI) selected in a 3 d array image (RGB) without converting to grayscale?

Illustration
vidya - 2024-01-19T13:11:33+00:00
Question: How can I filter region of interest (ROI) selected in a 3 d array image (RGB) without converting to grayscale?

Create a filter or mask for a selected region in High Dynamic Range images (HDRI). Using the example for ROI in grayscale images, create filter ROI for 3 d array images. The HDRI file cannot loose the properties. Is there a workaround? *1.)Code used for filtering sample grayscale example: * img = imread('pout.tif'); h_im = imshow(img);e = imellipse(gca,[55 10 120 120]);BW = createMask(e,h_im);h = fspecial('unsharp');I2 = roifilt2(h,img,BW);figure, imshow(I2);2.*)Stuck in the solution for filtering sample HDRI example? * P = hdrread('HDR');imshow(P);R = tonemap(P);figure, imshow®;whosimageSizeX = 3000;imageSizeY = 1500;imageSizeZ = 3;centerX = 1500;centerY= 750;centerZ= 1.5;[columnsInImage rowsInImage pagesInImage] = meshgrid(1:imageSizeX, 1:imageSizeY,1:imageSizeZ);radius = 300; sphereVoxels = (rowsInImage - centerY).^2 ... + (columnsInImage - centerX).^2 + (pagesInImage - centerZ).^2 <= radius.^2;fv = isosurface(sphereVoxels,0);patch(fv,'FaceColor',[0 0 .7],'EdgeColor',[0 0 1]);figure, view(90,90);axis equal;   How do I proceed with the next step or is there a mistake in-between??? Apologize limited understand. Hope someone can help.. Thanks  

Expert Answer

Profile picture of Kshitij Singh Kshitij Singh answered . 2025-11-20

 #2. Does 3D mean color or volumetric? And what does "not lose properties" mean? A filtered image will have different properties than the input image - at least SOME of them must be different or else the filter didn't do anything. And I have no idea what all that isosurface and patch stuff is for. What does that have to do with filtering color or volumetric images?

Why not just mask your image:

 

 

% Mask the image.
maskedRgbImage = bsxfun(@times, rgbImage, cast(mask,class(rgbImage)));

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!