How can I erase the pqtient's name,age,date,time,etc from the following image using matlab code

3 Ansichten (letzte 30 Tage)
Please Sir send me the code. It will be very helpful if you send me the complete code
  2 Kommentare

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 28 Mär. 2015
The code was not built with all images in mind - only one image was supplied so it might only work with images of that type. For your image it looks like you might just be able to find pure white pixels and set them to zero
grayImage(grayImage==255) = 0;
Of course it will need to be a little more robust since you will have to account for white pixels that might occur within the brain. So first you'll have to find the brain by thresholding, then fill it. Then mask that out so it's not touched when using the line above. Something like (untested)
brainPixels = grayImage > someThreshold;
%---------------------------------------------------------------------------
% Extract the largest area using our custom function ExtractNLargestBlobs().
biggestBlob = ExtractNLargestBlobs(brainPixels , 1);
biggestBlob = imfill(biggestBlob, 'holes');
%---------------------------------------------------------------------------
letters = grayImage == 255;
% Mask out brain.
letters(biggestBlob) = false;
% Erase letters
grayImage(letters) = 0;
See attached demo for the ExtractNLargestBlobs() function. Come back with any difficulties, otherwise, eventually mark the Answer as accepted if it works.
  4 Kommentare
Image Analyst
Image Analyst am 29 Mär. 2015
That image has white gridlines around it, like it's a portion of a contact sheet. You should get rid of those, like use imcrop() to extract only the part of the image within the grid tile. There are several other ways to do it but the key is to start with a good image. If you have to make it "good" to start with, then that will add several steps.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Read, Write, and Modify Image finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by