i m doing image enhancement using a transformation function.i need help in the coding.I have considered the (3,4)pixel value

1 vue (au cours des 30 derniers jours)
clear all;
close all;
input1=imread('cameraman.tif');
subplot(2,1,1),imshow(input1)
C=mean2(double(input1))%global mean
slidingmean=conv2(double(input1),ones(3)/9,'same');%local mean over 3 by 3 window
%figure(2),imshow(slidingmean)
J=stdfilt(input1);%standard deviation of the 3 by 3 neighborhood
figure(2),imshow(J,[])
a=1;b=.5;c=1;k=1.5;
K=(k*C)./(2.2423+b)
g=K*(157-(c*156.4444))+(156.4444).^a;%the transformation function
outpu1=g(input1);
figure(3),imshow(output1)

Réponse acceptée

Image Analyst
Image Analyst le 12 Sep 2013
Yeah, the 3,4 pixel - that one is always the troublemaker isn't he?
But since you didn't share your error message with us, I'm going to assume that it referred to output1 not being known. So try outpu1 instead of output1 and see if that works. Or else change outpu1 to output1 - either way should fix that error.
  5 commentaires
Image Analyst
Image Analyst le 13 Sep 2013
No you didn't. Your first comment gave only the line number and code on that line but did not give the actual error message description like you did in the second case.
You can't combine input, which is an integer with doubles. So case input to double before combining. Here, I fixed it for you and made some other improvements though you shoudl really go through and make descriptive variable names, not things like C, J, etc.
clear all;
close all;
input1=imread('pout.tif');
subplot(2,2,1);
imshow(input1);
C=mean2(double(input1))%global mean
caption = sprintf('input1, Global Mean = %2.f', C);
title(caption, 'FontSize', 25);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
slidingmean=conv2(double(input1),ones(3)/9,'same');%local mean over 3 by 3 window
%figure(2),imshow(slidingmean)
J=stdfilt(input1);%standard deviation of the 3 by 3 neighborhood
subplot(2,2,2);
imshow(J,[])
title('The (badly-named) J', 'FontSize', 25);
% Do a transform of some sort.
a=1;
b=.5;
c=1;
k=1.5;
K=(k.*C)./(J+b);
g=K.*(double(input1)-(c.*slidingmean))+(slidingmean).^a;%the transformation
output1=g.*double(input1);
% output1 displayed linearly will be very hard to see.
subplot(2,2,3);
imshow(output1, []);
title('output1', 'FontSize', 25);
% Apply a log transform to output1 so we can see it better.
subplot(2,2,4);
imshow(log(output1), []);
title('log(output1)', 'FontSize', 25);
Even the improvements I made wouldn't make it up to the level of robustness required my company for an app that is to be used by other people.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by