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

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)

 Accepted Answer

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 Comments

the error shown is Error in ==> project at 18 output1=g(input1); the outpu is a mistake,after changing there is no figure(3)
You should learn how to use the copy/paste capability of your computer. It will relieve you from a lot of typing and eliminate errors such as that. Plus it makes it easy for you to copy and paste all the red text into your reply. As it is, you have not supplied useful information. That small snippet of the full error message you posted is useless to us. If you want help, always, always post the full error message - all, ALL! the red text.
thats the thing i did ok fine here's a little different 1 but still i m not getting figure 3.d code is
clear all;
close all;
input1=imread('pout.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)./(J+b);
g=K.*(input1-(c.*slidingmean))+(slidingmean).^a;%the transformation
output1=g.*(input1);
figure(3),imshow(output1)
the error showing is ???
Error using ==> minus
Integers can only be combined with integers of the same class,
or scalar doubles.
Error in ==> project at 17
g=K.*(input1-(c.*slidingmean))+(slidingmean).^a;%the
transformation
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.

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!