How to reconstruct a corrupted image?

I have a corrupted image which i am supposed to reconstruct.
I want to remove upper layer and reconstruct the image.
The final output must look like this.

Answers (2)

I don't know what the "upper layer" is. First you can call rgb2gray() to convert it to gray scale. But after that there is a lot of judgment calls and artistic talent involved so, honestly, I'd use Photoshop for that (and I do all the time). It would be the fastest way.

7 Comments

I am not supposed to use photoshop. I am talking about upper yellowish layer on baby's face. I have converted image into gray scale already. I don't know what to do next. I have applied morphological structuering like imopen, imerode and imdillate as sell but didn't worked. Could you tell me what filters could be used to achieve the objective?
Try medfilt2 and regionfill and see attached demo of a modified median filter.
Why are you "not supposed to" use Photoshop? What/who is stopping you? Certainly not me.
Niranjunbutt
Niranjunbutt on 25 Apr 2023
Edited: Niranjunbutt on 25 Apr 2023
Didn't work.
You replied almost instantly, and didn't even answer my question. But such an automatic program to make such judgement calls for how to repair a photo could take years to write and make robust. Good luck.
Its an assignment and I am not supposed to use photoshop or AI. I have developed an algorithm of my own and it delivers quite fascinating results. And you are rude. Since I have said I am not supposed to use photoshop then why are you keep asking again and again.
Since this is a homework assignment, please show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the free MATLAB Onramp tutorial to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
I think you're forgetting who is asking for help and who is offering help. Repeating an unanswered question is not rude. I have therefore removed your flag.
Feel free to share your result in an answer. I would be interested to see your approach to undo cropping and discoloration.

Sign in to comment.

DGM
DGM on 9 May 2023
Edited: DGM on 9 May 2023
You can start by cleaning up a large part of the work like so:
inpict = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1365103/image.png');
gray = im2gray(inpict);
% remove the bulk of the cast
d = abs(im2double(inpict) - im2double(gray)); % isolate the non-gray component
d = mean(d,3); % reduce it to gray
outpict = gray + im2uint8(d);
imshow(outpict,'border','tight')
At this point, you can work on isolating and inpainting defects.
See also:
Note that this example still requires the user to identify the defect regions manually.

Categories

Asked:

on 24 Apr 2023

Edited:

DGM
on 9 May 2023

Community Treasure Hunt

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

Start Hunting!