make a mask for each well in a grid

亡梦爱人 提交于 2020-01-14 03:32:27

问题


I have a grid of wells in an image and I'm trying to analyze this in Matlab. I want to create a box around each well to use as a mask. The way I am trying to go about this is to find the offset vectors from the X and Y normal and then use that to make a grid since I know the size of the wells.

I can mask out some of the wells but not all of them---but this doesn't matter since I know that there is a well in every position (see here). I can use regionprops to get the centers but I can't figure out how to move to the next step.

Here is an image with the centers I can extract

Some people have suggested that I do an FFT of the image but I can't get it to work. Any thoughts or suggestions would be greatly appreciated. Thanks in advance!

Edit: Here is the mask with the centers from the centroid feature of regionprops.


回答1:


here's a quick and dirty 2 cents:

First blur and invert the image so that the well lines will have high intensity values vs the rest, and further analysis will be less sensitive to noise:

im=double(imread('im.jpg'));
im=conv2(im,fspecial('Gaussian',10,1),'same');
im2=abs(im-max(im(:)));

Then, take a local threshold using the average intensity around a neighborhood of (more or less) a well size (~200 pixels)

im3=imfilter(im2,fspecial('average',200),'replicate');
im4=im2-im3;
bw=im2bw(im4,0);

Fill holes (or wells):

[bw2,locations] = imfill(bw,'holes');

Remove objects smaller than some size:

bw3 = bwareaopen(bw2, 2000, 8);

imagesc(bw3);

You can take it from there...



来源:https://stackoverflow.com/questions/21100541/make-a-mask-for-each-well-in-a-grid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!