Dehazing a digital image in Matlab

5 views (last 30 days)
Imran Khan
Imran Khan on 20 Mar 2019
Answered: Image Analyst on 21 Mar 2019
I am attempting to dehaze an image of a drawing I created in Photoshop. My current program yields the following response:
>> % Read image
I=imread('C:\Users\Imran\Documents\Monster\monsterinthedark.jpg');
% Show image
imshow(I);
function J = deHaze(im)
JDark = darkChannel(im);
A = atmLight(im, JDark);
transmission = transmissionEstimate(im, A);
tMat = transmission;
J = getRadiance(A,im,tMat);
Warning: Image is too big to fit on screen; displaying at 50%
> In imuitools\private\initSize at 75
In imshow at 239
??? function J = deHaze(im)
|
Error: Function definitions are not permitted at the prompt or in scripts.
In addition, I am not confident that my attempt is correct. I wish to use dark channel prior, so I used the dehaze code given here:
I have also attached the image itself for reference. Could it be that the file is too large?

Answers (1)

Image Analyst
Image Analyst on 21 Mar 2019
It looks like you've typed that all into the command window after the >> prompt:
>> % Read image
I=imread('C:\Users\I...............
Try putting it into an m-file and running it.
In addition since you have a script followed by a function in the same m-file, you'd need to finish the function with an "end" as the last line.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Products


Release

R2007b

Community Treasure Hunt

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

Start Hunting!