why this code can't run in my PC but can run in another. it show error about "Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters"

1 view (last 30 days)
R=imread('test.png');
R=rgb2gray(R);
figure(1); imshow(R);
F=[0:255];
gamma1=0.6;
G1=(round(255*(F/255).^gamma1)
gamma2=0.4;
G2=(round(255*(F/255).^gamma2)
R2=uint8(zeros(size(R)));
R3=uint8(zeros(size(R)));
for i=1:numel(R)
R2(i)=G1(R(i)+1);
R3(i)=G2(R(i)+1);
end
figure(2); imshow(R2,[]);
figure(3); imshow(R3);
figure(4); plot(F,G1); xlabel('f(r,c)');ylabel('g(r,c)');
hold on
plot(F,G2);

Answers (1)

Sudhakar Shinde
Sudhakar Shinde on 3 Nov 2020
Looks like bracket close ')' missing for G1 & G2:
G1=(round(255*(F/255).^gamma1))
G2=(round(255*(F/255).^gamma2))

Categories

Find more on Environment and Settings in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!