필터 지우기
필터 지우기

Image Processing Question - Correlating Watershed Segmented Image with Original Image

조회 수: 1 (최근 30일)
Hello,
I have created a segmented image of an original image (both 256x256 pixels) with a watershed algorithm. In the segmented image, the lines (or segments) correspond to "grain boundaries" in my original image, which are significant features. I need to determine the gray values in the original image at these grain boundaries.
What I have done thus far is create a text file for the original image and for the segmented image which are both 256x256 lists of gray values, 0-255. The text file for the segmented image only has 0s (black in the image) and 255s (white in the image). The pixels with 255s are the places where the grain boundaries are in the original image. Therefore I need a code that returns the gray values in the original image that correspond to the 255 values in the segmented image. Do you have an idea of how to accomplish this?
Or, perhaps there is a simpler approach?
Anything helps!
Thanks,
John

채택된 답변

Image Analyst
Image Analyst 2013년 3월 21일
You can extract the edge pixels with the edge mask like this:
edgePixels = grayImage(edgeMask);
where edgeMask is the binary image (true/false, 1/0, white/black) of your edge locations. Then get the mean value of that by
meanEdgeGrayLevel = mean(edgePixels(:));
  댓글 수: 3
Image Analyst
Image Analyst 2013년 3월 21일
It's just a 1D list of all the gray levels under the edge mask. You can just do
[pixelCounts, grayLevels] = imhist(edgePixels, 256);
bar(grayLevels, pixelCounts);
xlim([0 255]);

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by