Centering Multiple circular images
7 次查看(过去 30 天)
显示 更早的评论
I have multiple images of circular EHL contacts. I need to track the color change of each location within the contact. This is difficult as the contact moves slightly in the different images.
I have tried using the following code to center the images
EHL_image = imread('filename.bmp');
bwimage = rgb2gray(EHL_image);
bwimage(1:460,:) = 0;
BW = im2bw(bwimage,.4);
BWout = imfill(BW,'holes');
[Center, Rad, metric] = imfindcircles(BWout,[100 150],'Method','twostage');
After this process, matlab produces a post-processed image and a predicted circle as seen in the figure "Post_process." I cut the upper portion of the image off as I have found removing the distortion caused by the wake improves imfindcircles accuracy. As seen in the image Post process, the imfindcircles function does not center the circle over the contact well and it greatly varies from image to image.
I need some way to create some type of reference point within the contact such that I can associate the RGB values at different pixel locations with the same location within the contact. This is difficult as all parts of the contact undergo color change as the speed is increased between images.
I have attached two original images of the EHL contact at different speeds. Any creative ideas would be greatly appreciated.
0 个评论
采纳的回答
Jim Riggs
2018-2-14
Here is a thought.
The images appear to have some significant circular waves emanating from the (presumed) center. I would use this periodic information to locate the center. For example, define two opposing vectors from some reference point near the center, one vector points left and the other points right. Compute the intensity of the image along each vector and plot vs distance from the reference point. Adjust the point left/right position until the periodic behaviors overlap. Now add a third vector pointing down. Adjust the up/down position until the periodic behavior of all three overlap. This should allow you to locate a center reference without using the top half of the image.
5 个评论
Jim Riggs
2018-2-16
Signal processing is not my strong point. I notice that the signal processing toolbox has a function "alignsignals" to align 2 signals by delaying one of them. There is also "xcorr" which computes the correlation and the lag between two similar signals.
Jim Riggs
2018-2-17
编辑:Jim Riggs
2018-2-17
How about this for a brute-force algorithm:
Select one of the well-defined peaks. Establish a window centered on this peak that is approximately +/- 1/2 the period. Now rotate the vector by a small amount and locate the peak inside the search window, and re-center the window. Trace this peak around 180 degrees. Now you have the distance to the same wave peak from 0 to 180 degrees.

It occurs to me that using this method, you would improve the vertical estimate by using more than 180 degrees of the image.
更多回答(1 个)
Image Analyst
2018-2-16
编辑:Image Analyst
2018-2-17
Try the attached script. It finds the circular region, finds the centroid of the region, finds the mean R, G, and B intensities in the circular mask region, and returns all the pixel values in the mask for each color channel.
You'll see:
The diameter = 268.39 pixels.
Mean Red Intensity = 123.18
Mean Green Intensity = 75.18
Mean Blue Intensity = 176.13
The Centroid is at x=445.903224, y=507.938276.

If you want to compare the very same pixels in different images (which, if analyzed separately might have slightly differently shaped masks) then you can just compute the mask once, and translate it, with imtranslate(), over each image to the centroid of that particular image. That way the mask is the same shape for all images. Though I still don't know exactly how you want to compare the colors: if it's the overall mean (seems okay), or if you want to somehow compare the R, G, and B values of each of the 56574 pixels in the mask (seems weird to me).
Does this work for you?
2 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!