Inserting "missing" element in 1D vector - need to find out if!

조회 수: 1 (최근 30일)
Jason
Jason 2016년 10월 25일
댓글: Jason 2016년 10월 25일
Hi.
I am trying to measure the location of "well defined" regular objects. In fact Im trying to measure the optical distortion in the x axis. Hence I create a "thinner" ROI from my full image, typically the full width but only about 20 pixels in height.
1: threshold the ROi image (ROIdist)
ROIbinary=ROIDist;
mn=mean(ROIDist(:))
sd=std(ROIDist(:))
thresh=mn+1.5*sd;
i = find ( ROIbinary <= thresh );
j = find ( ROIbinary > thresh );
ROIbinary(i) = 0; %CREATE BIMNNARY IMAGE FOR REGIONPROPS
ROIbinary(j) = 255;
2: I then use region props to obtain all the relevant info,in particular the centroid "x" location.
label = bwlabel(ROIbinary); %// label each object
stats = regionprops( label, ROIDist,'centroid', 'MeanIntensity','Area');
for x = 1:numel(stats)
plot(stats(x).Centroid(1),stats(x).Centroid(2),'b+');
cx(x)=stats(x).Centroid(1);
cy(x)=stats(x).Centroid(2);
area(x)=stats(x).Area;
pixvals(x) = ROIDist(round(cy(x)),round(cx(x))); %get intensity at centroid location
centroids(x,:)=[cx(x),cy(x),pixvals(x),area(x)];
end
this then allows me to compare the measured x locations with a well defined grid to hence measure the distortion. The problem is that my thresholding does occasionally, miss out one of the spots
Its seen below how its not picked out, and closer examination shows its quite week.
This is OK, unless there's an easy thresholding solution, I can manage with this IF I can insert a "dummy" x coordinate in the centroid x locations so that I have the correct number of elements to then subtract from the regular spaced vector. Being able to identify the spot too would be useful.
I'm not sure how to start on this one? How do I locate its missing without visually seeing the image and checking every part of it, I thought may diff could be used and if its too large then insert a point in between to two neigbours - but again not sure how to proceed.
thnaks
  댓글 수: 1
Jason
Jason 2016년 10월 25일
I wonder if tt might be better to remove the appropriate element from my reference grid?

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by