Display gray color only from grayscale image

조회 수: 7 (최근 30일)
Demons
Demons 2013년 1월 17일
Hi all
Apology for my ignorance as this is quite new to me.
I'm currently working on MRI images and have tried numerous times using some thresholding methods to display gray area of MRI image/s but to no avail.
Any pixel with grayscale value (0-255) of less than 5 & more than 250 will be eliminated and thus only showing pixels within 6-249.
Any helps are much appreciated.
Regards Demon
  댓글 수: 2
Walter Roberson
Walter Roberson 2013년 1월 17일
The places where those pixels were: do you need those places to be transparent?
Demons
Demons 2013년 1월 17일
transparent or black if that matter.

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

채택된 답변

Image Analyst
Image Analyst 2013년 1월 17일
You can alter the image to mask out (set to zero) those pixels with gray levels outside 5 and 250 inclusive:
darkPixels = grayImage <= 5;
lightPixels = grayImage >= 250;
pixelsToExclude = darkPixels | lightPixels;
grayImage(pixelsToExclude) = 0;
Is that what you want to do?
  댓글 수: 10
Demons
Demons 2013년 1월 18일
One word man - WOW!
This will save at least a good few weeks of my life. Really appreciate your effort.
If you happen to drop in Manchester someday, let me know.
Image Analyst
Image Analyst 2013년 1월 19일
You're welcome. The closest I get is Newcastle. But good luck with your project.

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

추가 답변 (2개)

Amith Kamath
Amith Kamath 2013년 1월 17일
For most tasks of analysing pixel values and thresholding, I've found http://www.mathworks.com/matlabcentral/fileexchange/6770 very useful.
You could use:
[levelLow bwLow] = thresh_tool(IM);
[levelHi bwHi] = thresh_tool(IM);
%to get the mask for each of the lower and upper level in bw.
depending on the datatype of your image, you can then just do an and operation between your image and the bw images.
  댓글 수: 1
Demons
Demons 2013년 1월 17일
Hi buddy
Thanks for your response. Appreciate that.
But gosh that was huge! Have you any idea of a much simpler one?

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


Jurgen
Jurgen 2013년 1월 17일
imshow(I,[6 249])
if it's a 2D image slice you want to visualize.
  댓글 수: 1
Demons
Demons 2013년 1월 17일
hi bud
i've tried that before and nothing changed.

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

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by