Image Analysis for curve in strong noise

2 次查看(过去 30 天)
Dear Matlab Community,
I am not new to programming image processing, but I have done other projects in Matlab with analyzing large matrices of data.
My current goal is to extract an equation of a curve from an image that has strong noise.
The image is a .TIF grayscale 1200x1600 uint16. It has numerous particles populating it with high intensity light and a fish in it.
I want to extract the curve of the fish. If someone could help me figure out how to remove the high intensity particles, it would help a ton.
I am currently trying to blur the image in the hopes that their small pixel count will remove many of them. Then I intend to use edge finder to draw the edge of the fish combined with Fourier transform functions to end up with the set of peaks.
-Tom

采纳的回答

Image Analyst
Image Analyst 2011-12-10
You say you're not new to image analysis, but it kind of sounds like you are. Have you tried thresholding? But the first step would be to get a good photo to begin with rather than try to fix up a bad one. You don't say what the lights are. Are they in the water or out of the water? Are they bioluminescent? Can you put polarizers in front of the lights and a rotatable polarizer in front of the camera lens? If you can't get rid of the lights then the best you can do is to try to remove them. Try to identify them by intensity, size, shape, or whatever. Then mask them out, if you want to or need to, and replace them with black or the surrounding image or something. You wouldn't want to blur them because that would also blur your outline of the fish and there are better ways of getting rid of bright spots in your image. Not sure why getting rid of bright spots would be necessary though - how do they affect the image of the fish? Anyway, then find the fish edges. I'm not sure what the equation of a curve for a fish would mean or how you'd calculate it, and what the Fourier transform has to do with anything and why you expect to get (somehow) a set of peaks. I'm sure a photo would illuminate your situation. Please upload one somewhere such as to tinypic.com.
  5 个评论
Image Analyst
Image Analyst 2011-12-11
I can barely see it on my monitor. It's basically a dimmer version of the second image.
Walter Roberson
Walter Roberson 2011-12-11
You are right, I see the dim curve now that I take a second look. And I probably had more glare on the other monitor.

请先登录,再进行评论。

更多回答(2 个)

Image Analyst
Image Analyst 2011-12-12
Thomas: Here's one of my functions that you might be able to use. It accepts a binary image and returns the "N" largest blobs in the output image.
% Retain the "numberToKeep" biggest blobs in a binary image.
function keeperBlobsImage = RetainLargestBlobs(binaryImage, numberToKeep)
try
% Label each blob so can do calc on it
[labeledImage numberOfBlobs] = bwlabel(binaryImage, 8);
% Make sure we don't attempt to keep more blobs than actually exist.
if numberToKeep > numberOfBlobs
numberToKeep = numberOfBlobs;
end
% Make the area measurements.
blobMeasurements = regionprops(labeledImage, 'Area'); % Get the blob properties of 'Area'
allAreas = [blobMeasurements.Area];
% Get a list of the blobs that meet our criteria and we need to keep.
[sortedAreas sortedIndices] = sort(allAreas, 'descend');
keeperIndexes = sortedIndices(1 : numberToKeep);
% Extract only those blobs that meet our criteria, and
% eliminate those blobs that don't meet our criteria.
% Note how we use ismember() to do this.
keeperBlobsImage = ismember(labeledImage, keeperIndexes);
catch ME
errorMessage = sprintf('Error in function RetainLargestBlobs.\n\nError Message:\n%s', ME.message);
WarnUser(errorMessage);
end
return; % from RetainLargestBlobs
  4 个评论
Thomas Reesbeck
Thomas Reesbeck 2011-12-13
[ydata,xdata] = find(cBW);
f = fittype('sin3');
fit1 = fit(xdata,ydata,f);
plot(fit1,xdata,ydata);
Currently fits well for me. Is this a good way of doing it?
Image Analyst
Image Analyst 2011-12-13
I don't have the Curve Fitting Toolbox. Looks like you're fitting it to a sine wave. If that's the model you want to use then it's probably the way to do it. You say it works well, so I guess it fits your needs. Maybe someone who has that toolbox can answer that better than me.

请先登录,再进行评论。


Thomas Reesbeck
Thomas Reesbeck 2011-12-12
Thanks for following up. I read some more this weekend, and found your BlobsDemo.m file. I will continue reading.
I currently have isolated the region I want and have found the edges to it.
Below is where I am at. I will be reading more of your File Exchange and going through the steps you mentioned to verify this.
C = imread('June_29_Fish_Brown000077.T000.D000.P000.H003.LA.TIF'); %load the tiff image into variable.
C=C*2^4;
L = medfilt2(C,[7 7]);
imshow(L);
level = graythresh(C);
BW = im2bw(L,level);
BW= double(BW);
imshow(BW);
figure,imshow(BW)
imshow(C);
K = regionprops(BW);
K(1)
BWJ = imcrop(BW,[K.BoundingBox(1) K.BoundingBox(2) K.BoundingBox(3) K.BoundingBox(4)]);
imshow(BWJ);
BW1 = edge(BWJ,'sobel');
BW2 = edge(BWJ,'canny');
imshow(BW1);
figure, imshow(BW2);

类别

Help CenterFile Exchange 中查找有关 Deep Learning for Image Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by