Projecting binary mask back onto image to read values
显示 更早的评论
I am trying to estimate average total signal of objects and average background value using the image processing tools. Whilst this is the first time I have attempted, I have read many examples and have applied the following method.
%1_Median Filter to remove some pixel noise
z1=medfilt2(im,[2,2]);
%2_Get background, my objects are typically <5 pixels
sb_open=imopen(im,strel('disk',100)); %Get features with radius>100
%3_Subtract original image from this
%4_Threshold and fill holes in binary image
level = graythresh(im)
z4_bw=im2bw(im,level);
z5 = imfill(z4_bw,'holes');
%5_dilate slightly so will cover all of objects when projected back to raw image
se = strel('disk',1);
I2 = imdilate(z5,se);
I have 4 questions.
1: If I am wanting to use this final processed binary image as a mask to project back onto the original image to obtain both the average intensities of the white area of the binary (i.e. the objects themselves), and then the black areas of the binary image to obtain the average background, is this a good approach?
2: How do I use this binary mask to obtain values corresponding to the white areas projected back to the original image
3: How do I use this binary mask to obtain the values corresponding to the black areas projected back to the original image?
4: The strel function for both imopen and dilate are manually entered. Are there any pointers to how this can be automated. I may have images where the same objects are represented by different numbe rof pixels (i.e. the magnification is changed upon image capture)
Thankyou for any assistance. Jason
2 个评论
Image Analyst
2014-10-24
Hard to say without seeing your image. Post it if you want specific help. An opening would give you a background if you had bright objects on a dark background, though a radius of 100 pixels is pretty large. It is not always appropriate to subtract a background from a grayscale image. In fact most times it is not, radiology and fluorescence being two exceptions that pop to mind. Possibly also topography. Most cases of reflective imaging would require a background division. If you don't know why, ask.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Region and Image Properties 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
