I've created a function to detect white edges in an image. This plot is a segment in an image (post processing of my function). The example above has a lot of noise in it, as you can see the segment I'm trying to plot is quite consistent along the 220 mark (y axis) and the large peaks (mostly above) represent noise, there are a few below also. Is there a function or some sort of way I can remove these large peaks? the function works quite well for the majority of images I'm using, data such as above is one of an awkward bunch.

 채택된 답변

Image Analyst
Image Analyst 2015년 2월 24일

0 개 추천

You can make it a bit more robust, but how about just thresholding, then interpolate what's left with interp1
badElements = signal > 230 | signal < 215;
newY = y(~badElements);
newX = x(~badElements);
xq = x;
fixedY = interp1(newX, newY, xq);
It would have been better if you had attached your data so people could have tried things.

댓글 수: 5

Sean
Sean 2015년 2월 24일
Sorry this is the image I'm dealing with, the separate plot above is just the line plotted on it's own! if my line is represented by a variable I'm not quite sure how to deal with its x and y values. The 220 value on the y axis above in the initial plot states a greyscale threshold (for detecting white regions). Thanks for the reply again
Image Analyst
Image Analyst 2015년 2월 25일
I don't know what to do with that. I thought you had a 1-D signal. Now you show me a 3D array - an RGB image that seems to be composed of several different things. What is your data actually - an image or a 1D signal? If it's a signal, attach it. If it's the image, then tell me what you want the output image to look like (attach the desired output image).
Sean
Sean 2015년 2월 25일
I edited the code you gave me and got what I was looking for, Since I'm looking to segment images based on tonal values some images are very sensitive to the threshold. Therefore I get noise such as above. If you look at the new plot attached, the orange line is what I was looking to do, get rid of the peaks and smooth out the line so the segment identifies the white region far more efficiently.
Sean
Sean 2015년 2월 25일
the image is greyscale so the plot is 2D also, thanks again for the help.
s 1024x1 8192 double

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

추가 답변 (0개)

질문:

2015년 2월 24일

댓글:

2015년 2월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by