Centering Multiple circular images

10 vues (au cours des 30 derniers jours)
morri295
morri295 le 14 Fév 2018
Commenté : Image Analyst le 19 Fév 2018
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.

Réponse acceptée

Jim Riggs
Jim Riggs le 14 Fév 2018
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 commentaires
Jim Riggs
Jim Riggs le 16 Fév 2018
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
Jim Riggs le 17 Fév 2018
Modifié(e) : Jim Riggs le 17 Fév 2018
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.

Connectez-vous pour commenter.

Plus de réponses (1)

Image Analyst
Image Analyst le 16 Fév 2018
Modifié(e) : Image Analyst le 17 Fév 2018
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 commentaires
morri295
morri295 le 19 Fév 2018
Thank you for your response and corresponding script. I attempted a similar approach initially but was not able to consistently get a good central location prediction across the various images.
Unfortunately, I must be running an older version of Matlab because the bwareafilt function in your script is not found in my version (R2013a). I was unable to see if your script did a better job than my initial attempt.
Image Analyst
Image Analyst le 19 Fév 2018
You can use bwareaopen() instead of bwareafilt() in many cases.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by